diff --git a/src/plugins/coreplugin/editormanager/editormanager.cpp b/src/plugins/coreplugin/editormanager/editormanager.cpp index 76b2ea1de8527587e8f6ac9464889b09835a1ec0..94473ab132325ba8ce6002e6b574bbe62bbe29f5 100644 --- a/src/plugins/coreplugin/editormanager/editormanager.cpp +++ b/src/plugins/coreplugin/editormanager/editormanager.cpp @@ -713,7 +713,7 @@ void EditorManager::closeEditor(const QModelIndex &index) m_d->m_editorModel->removeEditor(index); } -bool EditorManager::closeEditors(const QList<IEditor*> editorsToClose, bool askAboutModifiedEditors) +bool EditorManager::closeEditors(const QList<IEditor*> &editorsToClose, bool askAboutModifiedEditors) { if (editorsToClose.isEmpty()) return true; @@ -939,8 +939,10 @@ Core::IEditor *EditorManager::activateEditor(Core::Internal::EditorView *view, C Core::IEditor *EditorManager::activateEditor(Core::Internal::EditorView *view, Core::IFile *file, OpenEditorFlags flags) { - QList<IEditor*> editors = editorsForFile(file); - Q_ASSERT(!editors.isEmpty()); + const QList<IEditor*> editors = editorsForFile(file); + if (editors.isEmpty()) + return 0; + return activateEditor(view, editors.first(), flags); } diff --git a/src/plugins/coreplugin/editormanager/editormanager.h b/src/plugins/coreplugin/editormanager/editormanager.h index 781c9149db2e85318a192a391b9adc28107ef899..3697dd2a507b953ab359e87cfd69e4172760a49a 100644 --- a/src/plugins/coreplugin/editormanager/editormanager.h +++ b/src/plugins/coreplugin/editormanager/editormanager.h @@ -151,7 +151,7 @@ public: bool saveEditor(IEditor *editor); - bool closeEditors(const QList<IEditor *> editorsToClose, bool askAboutModifiedEditors = true); + bool closeEditors(const QList<IEditor *> &editorsToClose, bool askAboutModifiedEditors = true); MakeWritableResult makeEditorWritable(IEditor *editor); diff --git a/src/plugins/coreplugin/editormanager/openeditorswindow.cpp b/src/plugins/coreplugin/editormanager/openeditorswindow.cpp index adea351d961d9a5d292b1d9a21d17f00c16d10b3..0a8210378c84c80d5058ea92fda2db32818b9f42 100644 --- a/src/plugins/coreplugin/editormanager/openeditorswindow.cpp +++ b/src/plugins/coreplugin/editormanager/openeditorswindow.cpp @@ -242,7 +242,7 @@ void OpenEditorsWindow::setEditors(EditorView *mainView, EditorView *view, OpenE first = false; } } -} + } // add purely restored editors which are not initialised yet foreach (const OpenEditorsModel::Entry &entry, model->entries()) {