mirror of
https://github.com/EDCD/EDMarketConnector.git
synced 2025-04-17 17:42:20 +03:00
plugins/eddn: Add paranoia about data in is_horizons()
A damaged station has `"modules": []`, so trips over modules.values().
This commit is contained in:
parent
09e93068ab
commit
98be182922
@ -789,8 +789,18 @@ MAP_STR_ANY = Mapping[str, Any]
|
|||||||
|
|
||||||
|
|
||||||
def is_horizons(economies: MAP_STR_ANY, modules: MAP_STR_ANY, ships: MAP_STR_ANY) -> bool:
|
def is_horizons(economies: MAP_STR_ANY, modules: MAP_STR_ANY, ships: MAP_STR_ANY) -> bool:
|
||||||
return (
|
economies_colony = False
|
||||||
any(economy['name'] == 'Colony' for economy in economies.values()) or
|
modules_horizons = False
|
||||||
any(module.get('sku') == HORIZ_SKU for module in modules.values()) or
|
ship_horizons = False
|
||||||
any(ship.get('sku') == HORIZ_SKU for ship in (ships['shipyard_list'] or {}).values())
|
|
||||||
)
|
if isinstance(dict, economies):
|
||||||
|
economies_colony = any(economy['name'] == 'Colony' for economy in economies.values())
|
||||||
|
|
||||||
|
if isinstance(dict, modules):
|
||||||
|
modules_horizons = any(module.get('sku') == HORIZ_SKU for module in modules.values())
|
||||||
|
|
||||||
|
if isinstance(dict, ships):
|
||||||
|
if ships.get('shipyard_list') is not None:
|
||||||
|
ship_horizons = any(ship.get('sku') == HORIZ_SKU for ship in ships['shipyard_list'].values())
|
||||||
|
|
||||||
|
return economies_colony or modules_horizons or ship_horizons
|
||||||
|
Loading…
x
Reference in New Issue
Block a user