Skip to content

Commit 1cd8244

Browse files
committed
ghidra/ghidra_py_functions: make it possible to query non-existing functions with get_global_function
1 parent 709a161 commit 1cd8244

File tree

1 file changed

+3
-1
lines changed

1 file changed

+3
-1
lines changed

ghidra/ghidra_py_functions.py

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -256,9 +256,11 @@ def iterate_table(tbl):
256256
yield tbl.getComponent(i)
257257

258258

259-
def get_global_function(name):
259+
def get_global_function(name, maybe=False):
260260
"""Get the function object from the given name"""
261261
result = list(getGlobalFunctions(name))
262+
if not result and maybe:
263+
return None
262264
if len(result) != 1:
263265
raise RuntimeError("Function {} is defined {} times".format(name, len(result)))
264266
return result[0]

0 commit comments

Comments
 (0)