summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorMarco Benelli <marco.benelli@qt.io>2018-06-08 10:32:58 +0200
committerMarco Benelli <marco.benelli@qt.io>2018-06-08 09:02:21 +0000
commit50f536b9ae47e6dc3cd9872fa69a8ec084ab7b65 (patch)
tree1bbb1d804a8423bdb3f8fe68564d2ce7cbaf1ccf
parent1ddfb443b686ef04cc0e28363308ce70d01f0d73 (diff)
downloadqt-creator-50f536b9ae47e6dc3cd9872fa69a8ec084ab7b65.tar.gz
QmlJs: check markers before cleaning them
Task-number: QTCREATORBUG-20197 Change-Id: If4594a72abf4acf2455e55688679ba7f78900f76 Reviewed-by: Tim Jenssen <tim.jenssen@qt.io>
-rw-r--r--src/plugins/qmljseditor/qmljseditordocument.cpp4
1 files changed, 4 insertions, 0 deletions
diff --git a/src/plugins/qmljseditor/qmljseditordocument.cpp b/src/plugins/qmljseditor/qmljseditordocument.cpp
index 4ca53d2ce3..caa2831f7d 100644
--- a/src/plugins/qmljseditor/qmljseditordocument.cpp
+++ b/src/plugins/qmljseditor/qmljseditordocument.cpp
@@ -597,6 +597,10 @@ void QmlJSEditorDocumentPrivate::updateOutlineModel()
static void cleanMarks(QVector<TextEditor::TextMark *> *marks, TextEditor::TextDocument *doc)
{
+ // if doc is null, this method is improperly called, so better do nothing that leave an
+ // inconsistent state where marks are cleared but not removed from doc.
+ if (!marks || !doc)
+ return;
for (TextEditor::TextMark *mark : *marks) {
doc->removeMark(mark);
delete mark;