QmlJs: check markers before cleaning them

Task-number: QTCREATORBUG-20197
Change-Id: If4594a72abf4acf2455e55688679ba7f78900f76
Reviewed-by: Tim Jenssen <tim.jenssen@qt.io>
This commit is contained in:
Marco Benelli
2018-06-08 10:32:58 +02:00
parent 1ddfb443b6
commit 50f536b9ae

View File

@@ -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;