From ce460712e2738bda299451980677ea7ef7b370ce Mon Sep 17 00:00:00 2001 From: Athanasius Date: Wed, 11 Sep 2019 16:49:28 +0100 Subject: [PATCH] Ensure we definitely can add mandatory fields to EDDN messages This came to light due to python3 not liking try['StarPos'] = list(this.coordinates) if this.coordinates was None. As the comment says these three fields are mandatory, ensure we can actually set them appropriately, and display an error if not. --- plugins/eddn.py | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-) diff --git a/plugins/eddn.py b/plugins/eddn.py index 1ed7c866..cc62747f 100644 --- a/plugins/eddn.py +++ b/plugins/eddn.py @@ -434,10 +434,16 @@ def journal_entry(cmdr, is_beta, system, station, entry, state): # add mandatory StarSystem, StarPos and SystemAddress properties to Scan events if 'StarSystem' not in entry: + if not system: + return("system is None, can't add StarSystem") entry['StarSystem'] = system if 'StarPos' not in entry: + if not this.coordinates: + return("this.coordinates is None, can't add StarPos") entry['StarPos'] = list(this.coordinates) - if 'SystemAddress' not in entry and this.systemaddress: + if 'SystemAddress' not in entry: + if not this.systemaddress: + return("this.systemaddress is None, can't add SystemAddress") entry['SystemAddress'] = this.systemaddress try: