mirror of
https://github.com/Chatterino/chatterino2.git
synced 2024-11-13 19:49:51 +01:00
Fix rare reply mention crash (#4055)
* Fix potential out-of-range access of at when stripping reply mention if the message contained nothing other than the username * Update changelog entry
This commit is contained in:
parent
ceecc7ef91
commit
3e020b4891
|
@ -2,7 +2,7 @@
|
||||||
|
|
||||||
## Unversioned
|
## Unversioned
|
||||||
|
|
||||||
- Major: Added support for Twitch's Chat Replies. [Wiki Page](https://wiki.chatterino.com/Features/#message-replies) (#3722, #3989, #4041, #4047)
|
- Major: Added support for Twitch's Chat Replies. [Wiki Page](https://wiki.chatterino.com/Features/#message-replies) (#3722, #3989, #4041, #4047, #4055)
|
||||||
- Major: Added multi-channel searching to search dialog via keyboard shortcut. (Ctrl+Shift+F by default) (#3694, #3875)
|
- Major: Added multi-channel searching to search dialog via keyboard shortcut. (Ctrl+Shift+F by default) (#3694, #3875)
|
||||||
- Minor: Added highlights for `Elevated Messages`. (#4016)
|
- Minor: Added highlights for `Elevated Messages`. (#4016)
|
||||||
- Minor: Removed total views from the usercard, as Twitch no longer updates the number. (#3792)
|
- Minor: Removed total views from the usercard, as Twitch no longer updates the number. (#3792)
|
||||||
|
|
|
@ -78,6 +78,13 @@ int stripLeadingReplyMention(const QVariantMap &tags, QString &content)
|
||||||
it != tags.end())
|
it != tags.end())
|
||||||
{
|
{
|
||||||
auto displayName = it.value().toString();
|
auto displayName = it.value().toString();
|
||||||
|
|
||||||
|
if (content.length() <= 1 + displayName.length())
|
||||||
|
{
|
||||||
|
// The reply contains no content
|
||||||
|
return 0;
|
||||||
|
}
|
||||||
|
|
||||||
if (content.startsWith('@') &&
|
if (content.startsWith('@') &&
|
||||||
content.at(1 + displayName.length()) == ' ' &&
|
content.at(1 + displayName.length()) == ' ' &&
|
||||||
content.indexOf(displayName, 1) == 1)
|
content.indexOf(displayName, 1) == 1)
|
||||||
|
|
Loading…
Reference in a new issue