Skip to content

Commit f39571e

Browse files
committed
Same as 26aa7b1, but for a different part of the code
1 parent 26aa7b1 commit f39571e

File tree

1 file changed

+4
-1
lines changed

1 file changed

+4
-1
lines changed

adafruit_gps.py

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -148,7 +148,10 @@ def _parse_sentence(self):
148148
sentence = self._uart.readline()
149149
if sentence is None or sentence == b'' or len(sentence) < 1:
150150
return None
151-
sentence = str(sentence, 'ascii').strip()
151+
try:
152+
sentence = str(sentence, 'ascii').strip()
153+
except UnicodeError:
154+
return None
152155
# Look for a checksum and validate it if present.
153156
if len(sentence) > 7 and sentence[-3] == '*':
154157
# Get included checksum, then calculate it and compare.

0 commit comments

Comments
 (0)