Fixed crash when uploading empty APRS message to APRS-IS

This commit is contained in:
marcel
2024-03-28 09:23:51 +01:00
parent 88e486936b
commit 589f303a16
2 changed files with 15 additions and 1 deletions

View File

@@ -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.

View File

@@ -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')