diff --git a/src/plugins/coreplugin/editormanager/editormanager.cpp b/src/plugins/coreplugin/editormanager/editormanager.cpp
index 8fe8eec17258e5407a47ed1479ef1dd7cb54a3b8..566d372f224a79e8ae874165e6e00537d3749889 100644
--- a/src/plugins/coreplugin/editormanager/editormanager.cpp
+++ b/src/plugins/coreplugin/editormanager/editormanager.cpp
@@ -1708,14 +1708,15 @@ QByteArray EditorManager::saveState() const
     QList<OpenEditorsModel::Entry> entries = m_d->m_editorModel->entries();
     int entriesCount = 0;
     foreach (const OpenEditorsModel::Entry &entry, entries) {
-        if (!entry.editor->isTemporary())
+        // The editor may be 0 if it was not loaded yet: In that case it is not temporary
+        if (!entry.editor || !entry.editor->isTemporary())
             ++entriesCount;
     }
 
     stream << entriesCount;
 
     foreach (const OpenEditorsModel::Entry &entry, entries) {
-        if (!entry.editor->isTemporary())
+        if (!entry.editor || !entry.editor->isTemporary())
             stream << entry.fileName() << entry.displayName() << entry.id().toUtf8();
     }