From a1eca4e2dd8d577330528a29415f1c5fd377a443 Mon Sep 17 00:00:00 2001 From: Nils Nemitz Date: Mon, 22 Mar 2021 13:14:19 +0900 Subject: [PATCH] handle empty adjanceny array (#1647) --- pyqtgraph/graphicsItems/GraphItem.py | 9 +++------ 1 file changed, 3 insertions(+), 6 deletions(-) diff --git a/pyqtgraph/graphicsItems/GraphItem.py b/pyqtgraph/graphicsItems/GraphItem.py index 0c279b30..9c4976fd 100644 --- a/pyqtgraph/graphicsItems/GraphItem.py +++ b/pyqtgraph/graphicsItems/GraphItem.py @@ -55,7 +55,9 @@ class GraphItem(GraphicsObject): """ if 'adj' in kwds: self.adjacency = kwds.pop('adj') - if self.adjacency is not None and self.adjacency.dtype.kind not in 'iu': + if hasattr(self.adjacency, '__len__') and len(self.adjacency) == 0: + self.adjacency = None + elif self.adjacency is not None and self.adjacency.dtype.kind not in 'iu': raise Exception("adjacency must be None or an array of either int or unsigned type.") self._update() if 'pos' in kwds: @@ -140,8 +142,3 @@ class GraphItem(GraphicsObject): def pixelPadding(self): return self.scatter.pixelPadding() - - - - -