mirror of
https://github.com/wassname/sloth.git
synced 2026-06-27 17:17:21 +08:00
fix crash on first launch
When there is no previous state you get a segmentation fault. This fixes it. Experienced by me and also kaggle user [Jeffrey Richley](https://www.kaggle.com/c/noaa-right-whale-recognition/forums/t/16328/python-alternative-to-labelling-tool/92693#post92693). Fault trace: ``` Traceback (most recent call last): File "./bin/sloth", line 16, in <module> labeltool.execute_from_commandline(sys.argv) File "C:\personal\kaggle\sloth\sloth\core\labeltool.py", line 152, in execute_from_commandline self._mainwindow = MainWindow(self) File "C:\personal\kaggle\sloth\sloth\gui\labeltool.py", line 74, in __init__ self.loadApplicationSettings() File "C:\personal\kaggle\sloth\sloth\gui\labeltool.py", line 308, in loadApplicationSettings self.restoreState(state) TypeError: QMainWindow.restoreState(QByteArray, int version=0): argument 1 has unexpected type 'NoneType' ```
This commit is contained in:
@@ -305,7 +305,8 @@ class MainWindow(QMainWindow):
|
||||
if isinstance(locked, QVariant): locked = locked.toBool()
|
||||
self.resize(size)
|
||||
self.move(pos)
|
||||
self.restoreState(state)
|
||||
if state is not None:
|
||||
self.restoreState(state)
|
||||
self.ui.actionLocked.setChecked(bool(locked))
|
||||
|
||||
def saveApplicationSettings(self):
|
||||
|
||||
Reference in New Issue
Block a user