From 65970dec03382c5808b8d84f97b340650648a1b5 Mon Sep 17 00:00:00 2001 From: Jonathan Harris Date: Tue, 20 Jun 2017 01:05:23 +0100 Subject: [PATCH] ShipID can be zero --- EDMarketConnector.py | 4 ++-- edsm.py | 2 +- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/EDMarketConnector.py b/EDMarketConnector.py index acb5aa43..89df1561 100755 --- a/EDMarketConnector.py +++ b/EDMarketConnector.py @@ -447,7 +447,7 @@ class AppWindow: elif ((auto_update and not data['commander'].get('docked')) or (monitor.system and data['lastSystem']['name'] != monitor.system) or (monitor.station and data['lastStarport']['name'] != monitor.station) or - (monitor.state['ShipID'] and data['ship']['id'] != monitor.state['ShipID']) or + (monitor.state['ShipID'] is not None and data['ship']['id'] != monitor.state['ShipID']) or (monitor.state['ShipType'] and data['ship']['name'].lower() != monitor.state['ShipType'])): raise companion.ServerLagging() @@ -820,7 +820,7 @@ class AppWindow: self.status['text'] = _("Where are you?!") # Shouldn't happen elif not data.get('ship') or not data['ship'].get('modules') or not data['ship'].get('name','').strip(): self.status['text'] = _("What are you flying?!") # Shouldn't happen - elif (monitor.state['ShipID'] and data['ship']['id'] != monitor.state['ShipID']) or (monitor.state['ShipType'] and data['ship']['name'].lower() != monitor.state['ShipType']): + elif (monitor.state['ShipID'] is not None and data['ship']['id'] != monitor.state['ShipID']) or (monitor.state['ShipType'] and data['ship']['name'].lower() != monitor.state['ShipType']): self.status['text'] = _('Error: Server is lagging') # Raised when Companion API server is returning old data, e.g. when the servers are too busy else: self.status['text'] = '' diff --git a/edsm.py b/edsm.py index cddd71d8..5cb63aa2 100644 --- a/edsm.py +++ b/edsm.py @@ -187,7 +187,7 @@ class EDSM: ) if coordinates: args += '&x=%.3f&y=%.3f&z=%.3f' % coordinates - if shipid: + if shipid is not None: args += '&shipId=%d' % shipid reply = self.call('api-logs-v1/set-log', args)