Do not choke on fits for unknown ships

This commit is contained in:
DarkPhoenix
2019-10-25 01:00:32 +03:00
parent 0ceb8acd64
commit 64f47fcc24

View File

@@ -112,11 +112,14 @@ class Fit:
ship = eos.db.getItem(shipID)
if ship is not None:
shipMap[shipID] = (ship.name, ship.getShortName())
fitsToPurge = set()
for fit in fits:
try:
fit.shipName, fit.shipNameShort = shipMap[fit.shipID]
except KeyError:
pass
except (KeyError, TypeError):
fitsToPurge.add(fit)
for fit in fitsToPurge:
fits.remove(fit)
return fits
@staticmethod