From 0e05efe56a6078f2316d1aa8d332e01357d9db6c Mon Sep 17 00:00:00 2001 From: Rossen Georgiev Date: Fri, 26 Dec 2014 14:04:08 +0000 Subject: [PATCH] catch ValueError when decoding lat/lng for MicE fixes #2 --- aprslib/parse.py | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) diff --git a/aprslib/parse.py b/aprslib/parse.py index 137fe75..84581d7 100644 --- a/aprslib/parse.py +++ b/aprslib/parse.py @@ -514,8 +514,11 @@ def parse(raw_sentence): symbol_table = packet[0] symbol = packet[9] - latitude = 90 - (base91.to_decimal(packet[1:5]) / 380926.0) - longitude = -180 + (base91.to_decimal(packet[5:9]) / 190463.0) + try: + latitude = 90 - (base91.to_decimal(packet[1:5]) / 380926.0) + longitude = -180 + (base91.to_decimal(packet[5:9]) / 190463.0) + except ValueError: + raise ParseError("invalid characters in latitude/longitude encoding") # parse csT