From ab0729bb04bb143148e53807f8657e54adea7f6c Mon Sep 17 00:00:00 2001 From: Luke Campagnola Date: Fri, 28 Feb 2014 08:55:30 -0500 Subject: [PATCH] Add check for even array length when using arrayToQPath(connect='pairs') --- pyqtgraph/functions.py | 2 ++ 1 file changed, 2 insertions(+) diff --git a/pyqtgraph/functions.py b/pyqtgraph/functions.py index 64dad102..db22f8a3 100644 --- a/pyqtgraph/functions.py +++ b/pyqtgraph/functions.py @@ -1157,6 +1157,8 @@ def arrayToQPath(x, y, connect='all'): # decide which points are connected by lines if connect == 'pairs': connect = np.empty((n/2,2), dtype=np.int32) + if connect.size != n: + raise Exception("x,y array lengths must be multiple of 2 to use connect='pairs'") connect[:,0] = 1 connect[:,1] = 0 connect = connect.flatten()