From f7ca63ae36f31253a0bdfc8d9842942336db0c8d Mon Sep 17 00:00:00 2001 From: Tobias Hunger Date: Fri, 8 Oct 2010 15:47:30 +0200 Subject: [PATCH] Session: Fix ignoring of temporary files Fix ignoring temporary files when saving a session. This could crash when opening a session and saving it again if not all open editors were actually shown to the user. --- src/plugins/coreplugin/editormanager/editormanager.cpp | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/src/plugins/coreplugin/editormanager/editormanager.cpp b/src/plugins/coreplugin/editormanager/editormanager.cpp index 8fe8eec172..566d372f22 100644 --- a/src/plugins/coreplugin/editormanager/editormanager.cpp +++ b/src/plugins/coreplugin/editormanager/editormanager.cpp @@ -1708,14 +1708,15 @@ QByteArray EditorManager::saveState() const QList 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(); } -- 2.11.0