Handle empty shipyard list

e.g. at stations under repair
This commit is contained in:
Jonathan Harris committed 2018-12-29 17:43:50 +00:00
1 parent ea6a7b7df7
commit 3d85dd03a2
1 file changed
+1 -1
+1 -1
View File
@@ -213,7 +213,7 @@ class EDDN:
def export_shipyard(self, data, is_beta):
ships = data['lastStarport'].get('ships') or { 'shipyard_list': {}, 'unavailable_list': [] }
shipyard = sorted([ship['name'].lower() for ship in ships['shipyard_list'].values() + ships['unavailable_list']])
shipyard = sorted([ship['name'].lower() for ship in (ships['shipyard_list'] or {}).values() + ships['unavailable_list']])
if shipyard and this.shipyard != shipyard: # Don't send empty ships list - shipyard data is only guaranteed present if user has visited the shipyard.
self.send(data['commander']['name'], {
'$schemaRef' : 'https://eddn.edcd.io/schemas/shipyard/2' + (is_beta and '/test' or ''),