From 142a56159e5d1fcc5f6e609731d79075e94757c7 Mon Sep 17 00:00:00 2001 From: Jeffrey Phillips Freeman <jeffrey.freeman@syncleus.com> Date: Fri, 30 Sep 2016 08:06:41 -0400 Subject: [PATCH] Fixing an IndexError when using python3. Issue: #32 --- src/apex/aprs/aprs.py | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/apex/aprs/aprs.py b/src/apex/aprs/aprs.py index ca6f966..2fb7f3b 100644 --- a/src/apex/aprs/aprs.py +++ b/src/apex/aprs/aprs.py @@ -45,13 +45,13 @@ class Aprs(object): frame_len = len(raw_frame) if frame_len > 16: - for raw_slice in range(0, frame_len): + for raw_slice in range(0, frame_len - 2): # Is address field length correct? if raw_frame[raw_slice] & 0x01 and ((raw_slice + 1) % 7) == 0: i = (raw_slice + 1) / 7 # Less than 2 callsigns? if 1 < i < 11: - if (raw_frame[raw_slice + 1] & 0x03 == 0x03 and raw_frame[raw_slice + 2] in [0xf0, 0xcf]): + if raw_frame[raw_slice + 1] & 0x03 is 0x03 and raw_frame[raw_slice + 2] in [0xf0, 0xcf]: frame['text'] = ''.join(map(chr, raw_frame[raw_slice + 3:])) frame['destination'] = Aprs.__identity_as_string(Aprs.__extract_callsign(raw_frame)) frame['source'] = Aprs.__identity_as_string(Aprs.__extract_callsign(raw_frame[7:])) -- GitLab