Don't crash if data is None while saving session
Under some circumstances I can't reproduce (switching/turning off monitors?) it seems it's possible that SessionManager.save gets called with last_window=True, without on_last_window_closed being called. This might be to one of the Qt screen management bugs fixed in Qt 5.6, which would explain why I can't reproduce it. Instead of crashing, let's log the error and not save the session.
This commit is contained in:
parent
20f80610be
commit
a33aa524de
@ -241,7 +241,9 @@ class SessionManager(QObject):
|
|||||||
log.sessions.debug("Saving session {} to {}...".format(name, path))
|
log.sessions.debug("Saving session {} to {}...".format(name, path))
|
||||||
if last_window:
|
if last_window:
|
||||||
data = self._last_window_session
|
data = self._last_window_session
|
||||||
assert data is not None
|
if data is None:
|
||||||
|
log.sessions.error("last_window_session is None while saving!")
|
||||||
|
return
|
||||||
else:
|
else:
|
||||||
data = self._save_all()
|
data = self._save_all()
|
||||||
log.sessions.vdebug("Saving data: {}".format(data))
|
log.sessions.vdebug("Saving data: {}".format(data))
|
||||||
|
Loading…
Reference in New Issue
Block a user