fix segfault in console code

This commit is contained in:
Malte Jürgens 2023-04-18 21:31:22 +02:00
parent 8f0a810539
commit 7b6e8fc473
No known key found for this signature in database
GPG Key ID: D29FBD5F93C0CFC3
1 changed files with 5 additions and 4 deletions

View File

@ -282,10 +282,11 @@ void DiscordPage::javaScriptConsoleMessage(
ansi += "\033[" + cssAnsiColorMap[color] + "m";
}
}
qDebug(discordLog) << (ansi + lines[0].trimmed() + "\033[0m " +
lines[endOfStyles].trimmed())
.toUtf8()
.constData();
if (endOfStyles < lines.length())
qDebug(discordLog) << (ansi + lines[0].trimmed() + "\033[0m " +
lines[endOfStyles].trimmed())
.toUtf8()
.constData();
for (auto line : lines.mid(endOfStyles + 1)) {
qDebug(discordLog) << line.toUtf8().constData();
}