From c50fb3bcbe0b2e384cc3e815049fb724a9e4e7c6 Mon Sep 17 00:00:00 2001 From: rthiermann <40699438+rthiermann@users.noreply.github.com> Date: Mon, 27 Nov 2023 17:15:13 -0800 Subject: [PATCH] Catch attribute error from missing widget parent --- src/napari_mm3/_deriving_widgets.py | 13 ++++++++----- 1 file changed, 8 insertions(+), 5 deletions(-) diff --git a/src/napari_mm3/_deriving_widgets.py b/src/napari_mm3/_deriving_widgets.py index 2f598b8..2a040ec 100644 --- a/src/napari_mm3/_deriving_widgets.py +++ b/src/napari_mm3/_deriving_widgets.py @@ -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 @@ -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 = []