forked from qt-creator/qt-creator
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:
@@ -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;
|
||||
|
Reference in New Issue
Block a user