EDCD / EDMarketConnector

Downloads commodity market and other station data from the game Elite: Dangerous for use with all popular online and offline trading tools.
GNU General Public License v2.0
992 stars 155 forks source link

Don't attempt sending `marketID` to Inara's `setCommandeTravelLocation` if source unset #1638

Closed Athanasius closed 1 year ago

Athanasius commented 2 years ago

Playing around with Guardian sites I've been seeing:

2022-08-12 10:47:07.270 UTC - DEBUG - 9972:22496:22496 plugins.inara.journal_entry:765: Adding events
Traceback (most recent call last):
  File "C:\Program Files (x86)\EDMarketConnector\plugins\inara.py", line 672, in journal_entry
    'marketID':             entry['MarketID'],
KeyError: 'MarketID'

caused by:

{ "timestamp":"2022-08-12T10:47:06Z", "event":"ApproachSettlement", "Name":"$Ancient:#index=1;", "Name_Localised":"Ancient Ruins (1)", "SystemAddress":4757716439746, "BodyID":12, "BodyName":"Synuefe XO-P c22-17 C 1", "Latitude":-30.239441, "Longitude":147.695908 }

So, we need to check if entry['MarketID' exists before adding it to the message. The Inara docs do say:

The market ID of the station. When provided, it is used as a primary location identifier.

Note the 'when', so it seems to be optional.

Athanasius commented 2 years ago

1639 failed to mention that it was closing this. So the fix has already been merged.