1
0
mirror of https://github.com/EDCD/EDMarketConnector.git synced 2025-04-14 16:27:13 +03:00

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.
This commit is contained in:
Athanasius 2019-09-11 16:49:28 +01:00
parent bebc3648b8
commit ce460712e2

View File

@ -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: