From f8cfb67d028814fe6263febc1ffc24d99e6be68c Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Ana=20Mar=C3=ADa=20Mart=C3=ADnez=20G=C3=B3mez?= Date: Thu, 2 Jul 2020 11:10:28 +0200 Subject: [PATCH] Fix KeyError in Range#evaluate() If the key doesn't exist, `evaluate` raises a `KeyError` Exception, making the tests fail. --- capa/engine.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/capa/engine.py b/capa/engine.py index 15a05796..bdeff9ff 100644 --- a/capa/engine.py +++ b/capa/engine.py @@ -158,7 +158,7 @@ class Range(Statement): if self.min == 0 and count == 0: return Result(True, self, []) - return Result(self.min <= count <= self.max, self, [], locations=ctx[self.child]) + return Result(self.min <= count <= self.max, self, [], locations=ctx.get(self.child)) def __str__(self): if self.max == (1 << 64 - 1):