From f2244fbeeab045c5f015d1cb2f8f3b61c8ef1493 Mon Sep 17 00:00:00 2001 From: Thomas VINCENT Date: Mon, 18 Nov 2024 16:56:29 +0100 Subject: [PATCH] fix profile error when plot item is None --- src/silx/gui/plot/tools/profile/core.py | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/src/silx/gui/plot/tools/profile/core.py b/src/silx/gui/plot/tools/profile/core.py index 194f45936b..9e5c43152b 100644 --- a/src/silx/gui/plot/tools/profile/core.py +++ b/src/silx/gui/plot/tools/profile/core.py @@ -126,7 +126,10 @@ def _setPlotItem(self, plotItem): previousPlotItem = self.getPlotItem() if previousPlotItem is plotItem: return - self.__plotItem = weakref.ref(plotItem) + if plotItem is None: + self.__plotItem = None + else: + self.__plotItem = weakref.ref(plotItem) self.sigPlotItemChanged.emit() def getPlotItem(self):