Skip to content

Commit

Permalink
Ensure context menus can be called on items w/o market group
Browse files Browse the repository at this point in the history
  • Loading branch information
DarkFenX committed Jul 20, 2024
1 parent 9a3bde8 commit 777ba69
Showing 1 changed file with 2 additions and 2 deletions.
4 changes: 2 additions & 2 deletions gui/builtinContextMenus/cargoAddAmmo.py
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,7 @@ def display(self, callingWindow, srcContext, mainItem):
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)
Expand All @@ -34,7 +34,7 @@ def activate(self, callingWindow, fullContext, mainItem, i):
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)
Expand Down

0 comments on commit 777ba69

Please sign in to comment.