From 9572a51f28546845b768dec19636ff0118abf3b1 Mon Sep 17 00:00:00 2001 From: DarkPhoenix Date: Tue, 20 Aug 2019 21:48:06 +0300 Subject: [PATCH] Do not crash on None value in damage pattern editor --- eos/capSim.py | 3 --- gui/patternEditor.py | 6 +++--- 2 files changed, 3 insertions(+), 6 deletions(-) diff --git a/eos/capSim.py b/eos/capSim.py index 0cccd88f5..06737b58b 100644 --- a/eos/capSim.py +++ b/eos/capSim.py @@ -141,9 +141,6 @@ class CapSimulator: awaitingInjectorsCounterWrap = Counter() self.reset() - #if len(self.state) == 0: - - push = heapq.heappush pop = heapq.heappop diff --git a/gui/patternEditor.py b/gui/patternEditor.py index 97c553525..543b5d71c 100644 --- a/gui/patternEditor.py +++ b/gui/patternEditor.py @@ -208,12 +208,12 @@ class DmgPatternEditor(AuxiliaryFrame): if self.block: return p = self.entityEditor.getActiveEntity() - total = sum([getattr(self, "%sEdit" % attr).GetValueFloat() for attr in self.DAMAGE_TYPES]) + total = sum([(getattr(self, "%sEdit" % attr).GetValueFloat() or 0) for attr in self.DAMAGE_TYPES]) for type_ in self.DAMAGE_TYPES: editBox = getattr(self, "%sEdit" % type_) percLabel = getattr(self, "%sPerc" % type_) - setattr(p, "%sAmount" % type_, editBox.GetValueFloat()) - percLabel.SetLabel("%.1f%%" % (float(editBox.GetValueFloat()) * 100 / total if total > 0 else 0)) + setattr(p, "%sAmount" % type_, editBox.GetValueFloat() or 0) + percLabel.SetLabel("%.1f%%" % ((editBox.GetValueFloat() or 0) * 100 / total if total > 0 else 0)) self.totSizer.Layout() DamagePattern.getInstance().saveChanges(p)