From 1ea4f5ab6fd41f1dac8239c462250104b623fb34 Mon Sep 17 00:00:00 2001 From: HashSplat Date: Thu, 31 Aug 2017 08:55:58 -0400 Subject: [PATCH] ImageItem render error if graph is too small. Fixed issue where render would error because 'mapToDevice' would return None if the view size was too small. --- pyqtgraph/graphicsItems/ImageItem.py | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/pyqtgraph/graphicsItems/ImageItem.py b/pyqtgraph/graphicsItems/ImageItem.py index 9588c586..764caf2d 100644 --- a/pyqtgraph/graphicsItems/ImageItem.py +++ b/pyqtgraph/graphicsItems/ImageItem.py @@ -358,6 +358,11 @@ class ImageItem(GraphicsObject): o = self.mapToDevice(QtCore.QPointF(0,0)) x = self.mapToDevice(QtCore.QPointF(1,0)) y = self.mapToDevice(QtCore.QPointF(0,1)) + + # Check if graphics view is too small to render anything + if o is None or x is None or y is None: + return + w = Point(x-o).length() h = Point(y-o).length() if w == 0 or h == 0: