Commit f7ca63ae authored by Tobias Hunger's avatar Tobias Hunger
Browse files

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.
parent 60cf5fe8
......@@ -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();
}
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment