From e38ce639f0e07dc9a01095b944e8ce565ffdafa2 Mon Sep 17 00:00:00 2001 From: Athanasius Date: Sun, 19 Jun 2022 11:47:24 +0100 Subject: [PATCH] eddn/fsssignaldiscovered: Catch where no signals pass checks Else we attempt to send an empty `signals` array, which the schema prohibits. --- plugins/eddn.py | 12 +++++++++--- 1 file changed, 9 insertions(+), 3 deletions(-) diff --git a/plugins/eddn.py b/plugins/eddn.py index 3c7dfeff..d0332cff 100644 --- a/plugins/eddn.py +++ b/plugins/eddn.py @@ -1396,14 +1396,14 @@ class EDDN: f"{s['SystemAddress']} != {aug_systemaddress}") continue - # Remove any _Localised keys (would only be in a USS signal) - s = filter_localised(s) - # Drop Mission USS signals. if "USSType" in s and s["USSType"] == "$USS_Type_MissionTarget;": logger.trace_if("plugin.eddn.fsssignaldiscovered", "USSType is $USS_Type_MissionTarget;, dropping") continue + # Remove any _Localised keys (would only be in a USS signal) + s = filter_localised(s) + # Remove any key/values that shouldn't be there per signal s.pop('event', None) s.pop('horizons', None) @@ -1413,6 +1413,12 @@ class EDDN: msg['message']['signals'].append(s) + if not msg['message']['signals']: + # No signals passed checks, so drop them all and return + logger.debug('No signals after checks, so sending no message') + self.fss_signals = [] + return None + # `horizons` and `odyssey` augmentations msg['message']['horizons'] = entry['horizons'] msg['message']['odyssey'] = entry['odyssey']