From de456bc5e136347b35fcfe46613283fa90e9a896 Mon Sep 17 00:00:00 2001 From: Jonathan Haigh Date: Wed, 18 Sep 2024 12:13:07 +0100 Subject: [PATCH] check for legend existing before use --- .../workbench/workbench/plotting/figureinteraction.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/qt/applications/workbench/workbench/plotting/figureinteraction.py b/qt/applications/workbench/workbench/plotting/figureinteraction.py index 4862ca526a72..9870a5dc399a 100644 --- a/qt/applications/workbench/workbench/plotting/figureinteraction.py +++ b/qt/applications/workbench/workbench/plotting/figureinteraction.py @@ -171,7 +171,7 @@ def _get_next_axis_scale(self, current_scale): def _correct_for_scroll_event_on_legend(self, event): # Corrects default behaviour in Matplotlib where legend is picked up by scroll event legend = event.inaxes.axes.get_legend() - if legend.get_draggable() and legend.contains(event): + if legend is not None and legend.get_draggable() and legend.contains(event): legend_set_draggable(legend, False) legend_set_draggable(legend, True)