diff --git a/Core/Chat/ChatReader.cs b/Core/Chat/ChatReader.cs index c98c455c..f28eb567 100644 --- a/Core/Chat/ChatReader.cs +++ b/Core/Chat/ChatReader.cs @@ -65,13 +65,18 @@ public void Update(IAddonDataProvider reader) string text = sb.ToString().ToLowerInvariant(); sb.Clear(); - - int firstSpaceIdx = text.AsSpan().IndexOf(' '); - string author = text.AsSpan(0, firstSpaceIdx).ToString(); - string msg = text.AsSpan(firstSpaceIdx + 1).ToString(); - - ChatMessageEntry entry = new(DateTime.Now, type, author, msg); - Messages.Add(entry); - logger.LogInformation(entry.ToString()); + try + { + int firstSpaceIdx = text.AsSpan().IndexOf(' '); + string author = text.AsSpan(0, firstSpaceIdx).ToString(); + string msg = text.AsSpan(firstSpaceIdx + 1).ToString(); + + ChatMessageEntry entry = new(DateTime.Now, type, author, msg); + Messages.Add(entry); + logger.LogInformation(entry.ToString()); + } catch (Exception e) + { + logger.LogError("ChatEntryError: " + e.ToString()); + } } }