From 1aaa38203650307a0dca98b954e36e04526728e8 Mon Sep 17 00:00:00 2001 From: Tyler Goodlet Date: Mon, 7 Feb 2022 08:47:03 -0500 Subject: [PATCH] Avoid null index race-error during startup --- piker/ui/_cursor.py | 11 ++++++----- 1 file changed, 6 insertions(+), 5 deletions(-) diff --git a/piker/ui/_cursor.py b/piker/ui/_cursor.py index d0f642e4..f6f8edde 100644 --- a/piker/ui/_cursor.py +++ b/piker/ui/_cursor.py @@ -109,11 +109,12 @@ class LineDot(pg.CurvePoint): # first = self._plot._arrays['ohlc'][0]['index'] # first = x[0] # i = index - first - i = index - x[0] - if i > 0 and i < len(y): - newPos = (index, y[i]) - QtWidgets.QGraphicsItem.setPos(self, *newPos) - return True + if index: + i = index - x[0] + if i > 0 and i < len(y): + newPos = (index, y[i]) + QtWidgets.QGraphicsItem.setPos(self, *newPos) + return True return False