From a9c4c191e92a5b81d9f574cdcc92c6809b2eac53 Mon Sep 17 00:00:00 2001 From: Athanasius Date: Thu, 8 Apr 2021 10:09:16 +0100 Subject: [PATCH] Don't try to generate a shipyard link if we have no known loadout. This is currently the case on Odyssey Alpha Phase 1 when logging in on-foot. There's no Journal 'Loadout' event, but the CAPI update does let us know we have a Sidewinder active. But `monitor.state['Modules']` is None. --- EDMarketConnector.py | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-) diff --git a/EDMarketConnector.py b/EDMarketConnector.py index e3312ed1..074e78d1 100755 --- a/EDMarketConnector.py +++ b/EDMarketConnector.py @@ -1076,16 +1076,20 @@ class AppWindow(object): def shipyard_url(self, shipname: str) -> str: """Despatch a ship URL to the configured handler.""" + if not (loadout := monitor.ship()): + logger.warning('No ship loadout, aborting.') + return '' + if not bool(config.get_int("use_alt_shipyard_open")): return plug.invoke(config.get_str('shipyard_provider'), 'EDSY', 'shipyard_url', - monitor.ship(), + loadout, monitor.is_beta) # Avoid file length limits if possible provider = config.get_str('shipyard_provider', default='EDSY') - target = plug.invoke(provider, 'EDSY', 'shipyard_url', monitor.ship(), monitor.is_beta) + target = plug.invoke(provider, 'EDSY', 'shipyard_url', loadout, monitor.is_beta) file_name = join(config.app_dir_path, "last_shipyard.html") with open(file_name, 'w') as f: