eddn/fsssignaldiscovered: Catch where no signals pass checks

Else we attempt to send an empty `signals` array, which the schema prohibits.
This commit is contained in:
Athanasius committed 2022-06-19 11:47:24 +01:00
1 parent f5f8607fae
commit e38ce639f0
1 file changed
+9 -3
+9 -3
View File
@@ -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']