diff --git a/Libraries/SPTarkov.Server.Core/Controllers/DialogueController.cs b/Libraries/SPTarkov.Server.Core/Controllers/DialogueController.cs index 0227f2f6..ce17f4d6 100644 --- a/Libraries/SPTarkov.Server.Core/Controllers/DialogueController.cs +++ b/Libraries/SPTarkov.Server.Core/Controllers/DialogueController.cs @@ -125,7 +125,14 @@ public class DialogueController( var data = new List(); foreach (var dialogueId in _dialogueHelper.GetDialogsForProfile(sessionId)) { - data.Add(GetDialogueInfo(dialogueId.Key, sessionId)); + var dialogueInfo = GetDialogueInfo(dialogueId.Key, sessionId); + + if (dialogueInfo is null) + { + continue; + } + + data.Add(dialogueInfo); } return data; @@ -137,13 +144,18 @@ public class DialogueController( /// Dialog id /// Session Id /// DialogueInfo - public virtual DialogueInfo GetDialogueInfo( + public virtual DialogueInfo? GetDialogueInfo( string? dialogueId, string sessionId) { var dialogs = _dialogueHelper.GetDialogsForProfile(sessionId); var dialogue = dialogs!.GetValueOrDefault(dialogueId); + if (!dialogue.Messages.Any()) + { + return null; + } + var result = new DialogueInfo { Id = dialogueId, @@ -214,6 +226,16 @@ public class DialogueController( var fullProfile = _saveServer.GetProfile(sessionId); var dialogue = GetDialogByIdFromProfile(fullProfile, request); + if (!dialogue.Messages.Any()) + { + return new GetMailDialogViewResponseData + { + Messages = [], + Profiles = [], + HasMessagesWithRewards = false + }; + } + // Dialog was opened, remove the little [1] on screen dialogue.New = 0;