From f0fe632cae5a729db88b44130e1cfbb651cb311c Mon Sep 17 00:00:00 2001 From: marcel Date: Mon, 8 Jan 2024 10:26:17 +0100 Subject: [PATCH] Fixed crash after receiving empty APRS payload --- CHANGELOG.md | 21 ++++++++++++++++++--- aprs-mqtt-bridge.py | 6 +++++- 2 files changed, 23 insertions(+), 4 deletions(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index 179f473..a1f1144 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -13,10 +13,25 @@ All notable changes to this project will be documented in this file. - First working version. ## [1.0.1] - 2023-01-14 -- Changed: aprs_status (published on the MQTT broker) now returns actual state of transmision (sending, retrying, send or failed) instead if just 'ready' and 'busy'. + +### Changed + +- aprs_status (published on the MQTT broker) now returns actual state of transmision (sending, retrying, send or failed) instead if just 'ready' and 'busy'. ## [1.1.0] - 2023-07-08 -- Added: APRS nodes can now be polled to get there actual status. An extra section in the YAML configuration file is added for this functionality. + +### Added + +- APRS nodes can now be polled to get there actual status. An extra section in the YAML configuration file is added for this functionality. ## [1.1.1] - 2024-01-04 -- Fixed: after reconnect to MQTT broker messages from broker were not received. + +### Fixed + +- after reconnect to MQTT broker messages from broker were not received. + +## [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 diff --git a/aprs-mqtt-bridge.py b/aprs-mqtt-bridge.py index 05855b0..42f6270 100755 --- a/aprs-mqtt-bridge.py +++ b/aprs-mqtt-bridge.py @@ -76,7 +76,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'