CMakePM: Fix crash in rstparser

Change-Id: I5a9e456214581800c977e69da01aab1053cc554f
Reviewed-by: Cristian Adam <cristian.adam@qt.io>
This commit is contained in:
Christian Stenger
2023-10-11 15:04:55 +02:00
parent e508615243
commit 344ac9813d

View File

@@ -212,7 +212,7 @@ void rst::Parser::ParseBlock(
}
// Remove a trailing newline.
if (*text.rbegin() == '\n')
if (!text.empty() && *text.rbegin() == '\n')
text.resize(text.size() - 1);
bool literal = type == PARAGRAPH && EndsWith(text, "::");