Skip to content

Commit

Permalink
Merge pull request #640 from lionaneesh/dev-upstream
Browse files Browse the repository at this point in the history
ChatReader: Do not attempt to look for the Author name while the payload is malformed.
  • Loading branch information
Xian55 authored Dec 19, 2024
2 parents 07d2622 + a949543 commit 843cae3
Showing 1 changed file with 6 additions and 0 deletions.
6 changes: 6 additions & 0 deletions Core/Chat/ChatReader.cs
Original file line number Diff line number Diff line change
Expand Up @@ -67,6 +67,12 @@ public void Update(IAddonDataProvider reader)
sb.Clear();

int firstSpaceIdx = text.AsSpan().IndexOf(' ');
if (firstSpaceIdx == -1)
{
logger.LogError($"Malformed payload: {text}");
return;
}

string author = text.AsSpan(0, firstSpaceIdx).ToString();
string msg = text.AsSpan(firstSpaceIdx + 1).ToString();

Expand Down

0 comments on commit 843cae3

Please sign in to comment.