From 13684bebe2a421157032bc3cfaf28e468d0c1eef Mon Sep 17 00:00:00 2001 From: "Martin T. H. Sandsmark" Date: Sat, 13 Aug 2016 18:20:53 +0200 Subject: [PATCH] Fix crash when failing to restore session REVIEW: 128670 BUG: 366217 --- src/ViewManager.cpp | 8 ++++++++ 1 file changed, 8 insertions(+) diff --git a/src/ViewManager.cpp b/src/ViewManager.cpp index 90ef863bd..b1efc0a35 100644 --- a/src/ViewManager.cpp +++ b/src/ViewManager.cpp @@ -941,6 +941,14 @@ void ViewManager::restoreSessions(const KConfigGroup& group) int tab = 1; foreach(int id, ids) { Session* session = SessionManager::instance()->idToSession(id); + + if (!session) { + qWarning() << "Unable to load session with id" << id; + // Force a creation of a default session below + ids.clear(); + break; + } + createView(session); if (!session->isRunning()) session->run();