Ensure context menus can be called on items w/o market group

This commit is contained in:
DarkPhoenix
2024-07-20 19:09:00 +02:00
parent 9a3bde872b
commit 777ba69ac4

View File

@@ -25,7 +25,7 @@ class AddToCargoAmmo(ContextMenuSingle):
return True
def getText(self, callingWindow, itmContext, mainItem):
if mainItem.marketGroup.name == "Scan Probes":
if mainItem.marketGroup and mainItem.marketGroup.name == "Scan Probes":
return _t("Add {0} to Cargo (x8)").format(itmContext)
return _t("Add {0} to Cargo (x1000)").format(itmContext)
@@ -34,7 +34,7 @@ class AddToCargoAmmo(ContextMenuSingle):
fitID = self.mainFrame.getActiveFit()
typeID = int(mainItem.ID)
if mainItem.marketGroup.name == "Scan Probes":
if mainItem.marketGroup and mainItem.marketGroup.name == "Scan Probes":
command = cmd.GuiAddCargoCommand(fitID=fitID, itemID=typeID, amount=8)
else:
command = cmd.GuiAddCargoCommand(fitID=fitID, itemID=typeID, amount=1000)