Fixed crash after receiving empty APRS payload

master
marcel 4 months ago
parent 99bad68439
commit b4f4fc351f
  1. 5
      CHANGELOG.md
  2. 8
      aprs_telemetry_to_mqtt.py

@ -10,6 +10,7 @@ All notable changes to this project will be documented in this file.
Security : in case of vulnerabilities.
## [1.0.0] - 2023-12-08
- First working version.
## [1.1.0] - 2023-12-18
@ -25,3 +26,7 @@ All notable changes to this project will be documented in this file.
### Fixed:
- Filters out digital status bit messages (send by node when given comand 06). This command is never issued by this program. But other programs might do. Tese messages were interpreted as telemetry data. But not any more.
## [1.1.2] - 2024-01--8
### Fixed
- In parsePacket(string): Occasionally a bad APRS packet is received causing the program to crash with an "IndexError: list index out of range". Fix: check if index IS out of range before copying it to payload

@ -181,7 +181,11 @@ def parsePacket(string):
source = listAddress[1]
destination = listAddress[0]
digipeaters = listAddress[2:]
payload = buffer[1]
# Occasionally a bad packet is received causng the program to crash with an "IndexError: list index out of range". Fix: check if index IS out of range before copying it to payload
if len(buffer) > 1:
payload = buffer[1]
else:
payload = 'NOT VALID'
else:
# If there was an error decoding the address we return save values which will be ignored by the rest of the program
source = 'NOCALL'
@ -382,5 +386,7 @@ def run():
if __name__ == '__main__':
#sys.stdout = sys.stderr = open('debug.log', 'w')
sys.stdout = sys.stderr = open('/home/marcel/aprs_telemetry_to_mqtt_debug.log', 'w')
run()

Loading…
Cancel
Save