summaryrefslogtreecommitdiff
path: root/python
diff options
context:
space:
mode:
Diffstat (limited to 'python')
-rw-r--r--python/highlevelil.py4
1 files changed, 3 insertions, 1 deletions
diff --git a/python/highlevelil.py b/python/highlevelil.py
index e815df48..589d6505 100644
--- a/python/highlevelil.py
+++ b/python/highlevelil.py
@@ -804,8 +804,10 @@ class HighLevelILFunction(object):
# for backwards compatibility
if isinstance(i, HighLevelILInstruction):
return i
- if (i < 0) or (i >= len(self)):
+ if i < -len(self) or i >= len(self):
raise IndexError("index out of range")
+ if i < 0:
+ i = len(self) + i
return HighLevelILInstruction(self, core.BNGetHighLevelILIndexForInstruction(self.handle, i), False, i)
def __setitem__(self, i, j):