From 589f303a169c63d8507bd1c7f885f07fa6be8b35 Mon Sep 17 00:00:00 2001 From: marcel Date: Thu, 28 Mar 2024 09:23:51 +0100 Subject: [PATCH] Fixed crash when uploading empty APRS message to APRS-IS --- CHANGELOG.md | 6 ++++++ pe1rxf_aprs.py | 10 +++++++++- 2 files changed, 15 insertions(+), 1 deletion(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index 6345738..12a119d 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -55,3 +55,9 @@ All notable changes to this project will be documented in this file. - PE1RXF telemetry to MQTT bridge - Forwarding of APRS messages to MQTT + +## [0.1.4] - 2024-03-28 + +### Fixed + +- Sporadic crash when uploading RF packet to APRS-IS when payload (message) is empty. Added extra check to payload. diff --git a/pe1rxf_aprs.py b/pe1rxf_aprs.py index 25e6289..a30f3d6 100644 --- a/pe1rxf_aprs.py +++ b/pe1rxf_aprs.py @@ -222,6 +222,14 @@ def process_aprsis(packet): return 1 def send_aprsis(srcCall, dest, digi, msg): + # Bug, once the program crashed when accessing msg[0] because of "error IndexError: string index out of range". This should never happen, because the function parsePacket checks for this. + # But id did happen, don't know why. But to prevent is from happening again, we check it here as well: + try: + tmp = msg[0] + except: + print("Empty APRS message, nothing to do.") + return 1 + try: APRSIS.connect() except: @@ -549,7 +557,7 @@ def run(): #aprs_frame = axaddress[0] + '>' + destination + ',' + ','.join(digipeaters) + ':' + payload #print (aprs_frame) - if payload == 'NOT VALID': + if payload == 'NOT VALID' or payload == 0: print (">>> Packet not valid, ignored.") else: log_ax25(axaddress[port], source, destination, ','.join(digipeaters), payload, 'R')