From 50f536b9ae47e6dc3cd9872fa69a8ec084ab7b65 Mon Sep 17 00:00:00 2001 From: Marco Benelli Date: Fri, 8 Jun 2018 10:32:58 +0200 Subject: [PATCH] QmlJs: check markers before cleaning them Task-number: QTCREATORBUG-20197 Change-Id: If4594a72abf4acf2455e55688679ba7f78900f76 Reviewed-by: Tim Jenssen --- src/plugins/qmljseditor/qmljseditordocument.cpp | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/src/plugins/qmljseditor/qmljseditordocument.cpp b/src/plugins/qmljseditor/qmljseditordocument.cpp index 4ca53d2ce3b..caa2831f7d1 100644 --- a/src/plugins/qmljseditor/qmljseditordocument.cpp +++ b/src/plugins/qmljseditor/qmljseditordocument.cpp @@ -597,6 +597,10 @@ void QmlJSEditorDocumentPrivate::updateOutlineModel() static void cleanMarks(QVector *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;