Skip to content

Commit 102d673

Browse files
committed
Only lookup ability if it exists
1 parent b042200 commit 102d673

File tree

1 file changed

+7
-6
lines changed

1 file changed

+7
-6
lines changed

sc2reader/objects.py

Lines changed: 7 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -244,12 +244,13 @@ def apply(self):
244244
if self.ability not in ABILITIES:
245245
print "Unknown ability (%s) in frame %s" % (hex(self.ability),self.frame)
246246
#raise ValueError("Unknown ability (%s)" % (hex(self.ability)),)
247-
ability = ABILITIES[self.ability]
248-
able = self.get_able_selection(ability)
249-
if able:
250-
object = able[0]
251-
ability = getattr(object, ability)
252-
ability(self.frame)
247+
else:
248+
ability = ABILITIES[self.ability]
249+
able = self.get_able_selection(ability)
250+
if able:
251+
object = able[0]
252+
ability = getattr(object, ability)
253+
ability(self.frame)
253254

254255
# claim units
255256
for obj in self.player.get_selection().current:

0 commit comments

Comments
 (0)