summaryrefslogtreecommitdiff
path: root/python
diff options
context:
space:
mode:
Diffstat (limited to 'python')
-rw-r--r--python/function.py7
1 files changed, 7 insertions, 0 deletions
diff --git a/python/function.py b/python/function.py
index 2ebc5a0c..619b21f9 100644
--- a/python/function.py
+++ b/python/function.py
@@ -1004,6 +1004,13 @@ class Function:
finally:
core.BNFreeVariableNameAndTypeList(v, count.value)
+ def get_variable_by_name(self, name: str) -> Optional['variable.Variable']:
+ """Get a specific variable or None if it doesn't exist"""
+ for v in self.vars:
+ if v.name == name:
+ return v
+ return None
+
@property
def indirect_branches(self) -> List['variable.IndirectBranchInfo']:
"""List of indirect branches (read-only)"""