diff options
author | Florian Bruhin <git@the-compiler.org> | 2016-04-10 17:47:14 +0200 |
---|---|---|
committer | Florian Bruhin <git@the-compiler.org> | 2016-04-10 18:03:29 +0200 |
commit | ced87b163fbd59d9672f3d415e22dd54d1d38c03 (patch) | |
tree | c3f792ed5129d87c75810f8d95dd033f33d9328d | |
parent | c5459abb65bbf5762f3876dee049a9759d666000 (diff) | |
download | qutebrowser-ced87b163fbd59d9672f3d415e22dd54d1d38c03.tar.gz qutebrowser-ced87b163fbd59d9672f3d415e22dd54d1d38c03.zip |
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.
-rw-r--r-- | qutebrowser/misc/sessions.py | 4 |
1 files changed, 3 insertions, 1 deletions
diff --git a/qutebrowser/misc/sessions.py b/qutebrowser/misc/sessions.py index d9937f66f..72a9b7224 100644 --- a/qutebrowser/misc/sessions.py +++ b/qutebrowser/misc/sessions.py @@ -241,7 +241,9 @@ class SessionManager(QObject): log.sessions.debug("Saving session {} to {}...".format(name, path)) if last_window: 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: data = self._save_all() log.sessions.vdebug("Saving data: {}".format(data)) |