Skip to content

Commit 843cae3

Browse files
authored
Merge pull request #640 from lionaneesh/dev-upstream
ChatReader: Do not attempt to look for the Author name while the payload is malformed.
2 parents 07d2622 + a949543 commit 843cae3

File tree

1 file changed

+6
-0
lines changed

1 file changed

+6
-0
lines changed

Core/Chat/ChatReader.cs

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -67,6 +67,12 @@ public void Update(IAddonDataProvider reader)
6767
sb.Clear();
6868

6969
int firstSpaceIdx = text.AsSpan().IndexOf(' ');
70+
if (firstSpaceIdx == -1)
71+
{
72+
logger.LogError($"Malformed payload: {text}");
73+
return;
74+
}
75+
7076
string author = text.AsSpan(0, firstSpaceIdx).ToString();
7177
string msg = text.AsSpan(firstSpaceIdx + 1).ToString();
7278

0 commit comments

Comments
 (0)