DocumentModel: Add safeguard

It should never happen, but in the worst case do not
crash anyhow.

Task-number: QTCREATORBUG-19011
Change-Id: I9cd6f26929bf090262845b72d59a0654ad4eefff
Reviewed-by: Tobias Hunger <tobias.hunger@qt.io>
This commit is contained in:
Eike Ziller
2017-10-04 13:30:25 +02:00
parent 62b3f422c4
commit 1a19afc3e2

View File

@@ -367,6 +367,7 @@ DocumentModel::Entry *DocumentModelPrivate::removeEditor(IEditor *editor)
QTC_ASSERT(d->m_editors.contains(document), return nullptr);
d->m_editors[document].removeAll(editor);
DocumentModel::Entry *entry = DocumentModel::entryForDocument(document);
QTC_ASSERT(entry, return nullptr);
if (d->m_editors.value(document).isEmpty()) {
d->m_editors.remove(document);
entry->document = new IDocument;