Skip to content

Commit

Permalink
Catch attribute error from missing widget parent
Browse files Browse the repository at this point in the history
  • Loading branch information
rthiermann committed Nov 28, 2023
1 parent 75acca6 commit c50fb3b
Showing 1 changed file with 8 additions and 5 deletions.
13 changes: 8 additions & 5 deletions src/napari_mm3/_deriving_widgets.py
Original file line number Diff line number Diff line change
Expand Up @@ -416,10 +416,13 @@ def _get_most_recent_run(self):
return {}
# get the most recent run of the relevant widget.
old_params = {}
for historic_widget_name, _, params in reversed(history):
if historic_widget_name == self.parent.name:
old_params = params
break
try:
for historic_widget_name, _, params in reversed(history):
if historic_widget_name == self.parent.name:
old_params = params
break
except AttributeError:
pass

return old_params

Expand All @@ -445,7 +448,7 @@ def _save_settings(self):
"""
try:
widget_name = self.parent.name
except:
except AttributeError:
warning('Could not extract widget name to save settings.')
widget_name = ''
history = []
Expand Down

0 comments on commit c50fb3b

Please sign in to comment.