From 344ac9813d1f714705b8061d70bc6ce8efc64bc1 Mon Sep 17 00:00:00 2001 From: Christian Stenger Date: Wed, 11 Oct 2023 15:04:55 +0200 Subject: [PATCH] CMakePM: Fix crash in rstparser Change-Id: I5a9e456214581800c977e69da01aab1053cc554f Reviewed-by: Cristian Adam --- src/plugins/cmakeprojectmanager/3rdparty/rstparser/rstparser.cc | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/plugins/cmakeprojectmanager/3rdparty/rstparser/rstparser.cc b/src/plugins/cmakeprojectmanager/3rdparty/rstparser/rstparser.cc index f430c40e95d..8cf7af6fcb3 100644 --- a/src/plugins/cmakeprojectmanager/3rdparty/rstparser/rstparser.cc +++ b/src/plugins/cmakeprojectmanager/3rdparty/rstparser/rstparser.cc @@ -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, "::");