fixed crash when an exception is thrown off the bat (eg. can't open serial port)

This commit is contained in:
Kienan Stewart 2015-08-12 20:17:52 -04:00
parent 8efbcd935b
commit 3fe30ed27a
1 changed files with 6 additions and 2 deletions

View File

@ -117,7 +117,7 @@ class MainWindow(FloatLayout):
if 'time' in last_point:
self.lastTime = float(last_point['time'])
if 'exception' in last_point:
self.lastStatus = {'status' : 'error', 'message' : last_point['exception']}
self.lastStatus = {'status' : 'error', 'message' : last_point['exception']}
self.lastData = data
#if dataThreadDataQueue.qsize():
# Logger.debug('update_last_temperature: ' + str(dataThreadDataQueue.qsize()) + ' items left in queue after ' + str(len(data)) + ' items were taken out')
@ -513,7 +513,11 @@ class PlotWidget(Image):
if 'data' in point and 'time' in point and 'temperature' in point['data']:
points.append(numpy.array([(point['time'], point['data']['temperature'])],
dtype=float, ndmin =2))
extra_data = numpy.vstack(tuple(points))
extra_data = numpy.array(list(), dtype = float)
if points:
extra_data = numpy.vstack(tuple(points))
if not extra_data.any():
return
if not self.data.any():
self.data = extra_data
return