Fix traceback when trying to cancel an amount dialog with nothing in the field

This commit is contained in:
blitzman
2017-01-28 13:30:14 -05:00
parent f010f2fef2
commit 6b6dacf94c

View File

@@ -46,10 +46,15 @@ class AmountChanger(wx.Dialog):
self.button.Bind(wx.EVT_BUTTON, self.change)
def change(self, event):
if self.input.GetLineText(0).strip() == '':
event.Skip()
return
sFit = service.Fit.getInstance()
mainFrame = gui.mainFrame.MainFrame.getInstance()
fitID = mainFrame.getActiveFit()
print self.input.GetLineText(0), type(self.input.GetLineText(0))
if isinstance(self.thing, eos.types.Cargo):
sFit.addCargo(fitID, self.thing.item.ID, int(float(self.input.GetLineText(0))), replace=True)
elif isinstance(self.thing, eos.types.Fit):
@@ -60,7 +65,6 @@ class AmountChanger(wx.Dialog):
wx.PostEvent(mainFrame, GE.FitChanged(fitID=fitID))
event.Skip()
self.Close()
## checks to make sure it's valid number
def onChar(self, event):