From 200b269505be184663b3ce4d2968bd1c0f487f66 Mon Sep 17 00:00:00 2001 From: Keith Wiley Date: Fri, 9 Apr 2021 00:27:25 -0700 Subject: [PATCH] Made GPVTG parse cleanly even if sentence is empty. --- micropyGPS.py | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/micropyGPS.py b/micropyGPS.py index f8947f6..1d8b796 100644 --- a/micropyGPS.py +++ b/micropyGPS.py @@ -333,8 +333,8 @@ class MicropyGPS(object): def gpvtg(self): """Parse Track Made Good and Ground Speed (VTG) Sentence. Updates speed and course""" try: - course = float(self.gps_segments[1]) - spd_knt = float(self.gps_segments[5]) + course = float(self.gps_segments[1]) if self.gps_segments[1] else 0.0 + spd_knt = float(self.gps_segments[5]) if self.gps_segments[5] else 0.0 except ValueError: return False