From 8deaf0866f8ffe54efb3e0f7412108261d4ec75a Mon Sep 17 00:00:00 2001 From: Luke Campagnola Date: Thu, 21 Nov 2013 13:37:01 -0500 Subject: [PATCH] avoid division by zero when ViewBox has size or aspect = 0 --- pyqtgraph/graphicsItems/ViewBox/ViewBox.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/pyqtgraph/graphicsItems/ViewBox/ViewBox.py b/pyqtgraph/graphicsItems/ViewBox/ViewBox.py index 6ca2090c..3cbb1ea2 100644 --- a/pyqtgraph/graphicsItems/ViewBox/ViewBox.py +++ b/pyqtgraph/graphicsItems/ViewBox/ViewBox.py @@ -1352,7 +1352,7 @@ class ViewBox(GraphicsWidget): aspect = self.state['aspectLocked'] # size ratio / view ratio tr = self.targetRect() bounds = self.rect() - if aspect is not False and tr.width() != 0 and bounds.width() != 0: + if aspect is not False and aspect != 0 and tr.height() != 0 and bounds.height() != 0: ## This is the view range aspect ratio we have requested targetRatio = tr.width() / tr.height()