Check for tagToken length

Sometimes this part of the code causes segfault for me.

I don't know what the root cause is though, it's *very* random. I guess the tagToken should always be long enough, but sometimes it's just one character.
This commit is contained in:
Akseli Lahtinen
2024-05-08 19:41:39 +00:00
committed by Tobias Fella
parent 8c4ea6180a
commit ce1c6096d3

View File

@@ -389,7 +389,7 @@ QString TextHandler::stripBlockTags(QString string, const QString &tagType) cons
QString TextHandler::getTagType(const QString &tagToken) const
{
if (tagToken.isEmpty()) {
if (tagToken.isEmpty() || tagToken.length() < 2) {
return QString();
}
const int tagTypeStart = tagToken[1] == u'/' ? 2 : 1;