From 265d9026aabf05e6bfc9bda8346d357c2d51e84c Mon Sep 17 00:00:00 2001 From: Gabriel Gaessler Date: Sun, 19 Jun 2022 20:38:06 +0200 Subject: [PATCH] Fix rare startup bug in case there is a time but no date (#144) Signed-off-by: Gabriel Gaessler --- src/libnmea_navsat_driver/parser.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/libnmea_navsat_driver/parser.py b/src/libnmea_navsat_driver/parser.py index c33a9be..25a177f 100644 --- a/src/libnmea_navsat_driver/parser.py +++ b/src/libnmea_navsat_driver/parser.py @@ -156,7 +156,7 @@ def convert_time_rmc(date_str, time_str): tuple(float, float): 2-tuple of (NaN, NaN) if the sentence does not contain valid time. """ # If one of the time fields is empty, return NaN seconds - if not time_str[0:2] or not time_str[2:4] or not time_str[4:6]: + if not date_str[0:6] or not time_str[0:2] or not time_str[2:4] or not time_str[4:6]: return (float('NaN'), float('NaN')) pc_year = datetime.date.today().year