Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

ChatReader: Do not attempt to look for the Author name while the payload is malformed. #640

Merged
merged 2 commits into from
Dec 19, 2024

Conversation

lionaneesh
Copy link

No description provided.

Comment on lines 68 to 75

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());
Copy link
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Can you prove logs about this issue ?

Copy link
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

[20:36:45:267 E] Specified argument was out of the range of valid values. (Parameter 'start')
System.ArgumentOutOfRangeException: Specified argument was out of the range of valid values. (Parameter 'start')
at Core.ChatReader.Update(IAddonDataProvider reader) in C:\Users\liona\Downloads\dev\WowClassicGrindBot-dev\Core\Chat\ChatReader.cs:line 43
at Core.AddonReader.Update() in C:\Users\liona\Downloads\dev\WowClassicGrindBot-dev\Core\Addon\AddonReader.cs:line 73
at Core.BotController.AddonThread() in C:\Users\liona\Downloads\dev\WowClassicGrindBot-dev\Core\BotController.cs:line 156
at System.Threading.ExecutionContext.RunInternal(ExecutionContext executionContext, ContextCallback callback, Object state)
--- End of stack trace from previous location ---
at System.Threading.ExecutionContext.RunInternal(ExecutionContext executionContext, ContextCallback callback, Object state)
Unhandled exception. System.ArgumentOutOfRangeException: Specified argument was out of the range of valid values. (Parameter 'start')
at Core.ChatReader.Update(IAddonDataProvider reader) in C:\Users\liona\Downloads\dev\WowClassicGrindBot-dev\Core\Chat\ChatReader.cs:line 43
at Core.AddonReader.Update() in C:\Users\liona\Downloads\dev\WowClassicGrindBot-dev\Core\Addon\AddonReader.cs:line 73
at Core.BotController.AddonThread() in C:\Users\liona\Downloads\dev\WowClassicGrindBot-dev\Core\BotController.cs:line 156
at System.Threading.ExecutionContext.RunInternal(ExecutionContext executionContext, ContextCallback callback, Object state)
--- End of stack trace from previous location ---
at System.Threading.ExecutionContext.RunInternal(ExecutionContext executionContext, ContextCallback callback, Object state)

…n 'Space' character was not found in the payload.
@Xian55 Xian55 changed the title ChatReader: add try catch to prevent crash if parsing fails ChatReader: Do not attempt to look for the Author name while the payload is malformed. Dec 19, 2024
@Xian55 Xian55 merged commit 843cae3 into Xian55:dev Dec 19, 2024
1 check passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants