Fix runIgnoreReplaces fall into infinity loop (#2151)

* Fix `runIgnoreReplaces` fall into infinity loop

The regex pattern was not checked for emptiness, which led to an endless
loop

* Update CHANGELOG.md

Co-authored-by: pajlada <rasmus.karlsson@pajlada.com>
This commit is contained in:
fanway
2020-11-05 01:11:17 +03:00
committed by GitHub
parent 7d199c1329
commit f36c0fee97
2 changed files with 6 additions and 5 deletions
@@ -763,6 +763,11 @@ void TwitchMessageBuilder::runIgnoreReplaces(
{
continue;
}
const auto &pattern = phrase.getPattern();
if (pattern.isEmpty())
{
continue;
}
if (phrase.isRegex())
{
const auto &regex = phrase.getRegex();
@@ -835,11 +840,6 @@ void TwitchMessageBuilder::runIgnoreReplaces(
}
else
{
const auto &pattern = phrase.getPattern();
if (pattern.isEmpty())
{
continue;
}
int from = 0;
while ((from = this->originalMessage_.indexOf(
pattern, from, phrase.caseSensitivity())) != -1)