Handle empty session files gracefully

There's still much more to do for #1926, but with this we at least handle one
common case gracefully.

No tests because test_sessions.py is still in a kinda bad place...
This commit is contained in:
Florian Bruhin 2018-09-22 19:29:36 +02:00
parent 737db48c14
commit 22a4aaa73c
2 changed files with 4 additions and 0 deletions

View File

@ -75,6 +75,7 @@ Fixed
- When no documentation has been generated, the plaintext documentation now can
be shown for more files such as `qute://help/userscripts.html`.
- Crash when doing initial run on Wayland without XWayland
- Crash when trying to load an empty session file.
Removed
~~~~~~~

View File

@ -414,6 +414,9 @@ class SessionManager(QObject):
raise SessionError(e)
log.sessions.debug("Loading session {} from {}...".format(name, path))
if data is None:
raise SessionError("Got empty session file")
for win in data['windows']:
window = mainwindow.MainWindow(geometry=win['geometry'],
private=win.get('private', None))