From b6f9477e0283a40b08050c033bb06d4d7f9b2be6 Mon Sep 17 00:00:00 2001 From: Elias Bachaalany Date: Mon, 19 Jun 2017 08:36:46 -0700 Subject: [PATCH] fixed example --- examples/ex1_idaapi.py | 9 ++++++++- 1 file changed, 8 insertions(+), 1 deletion(-) diff --git a/examples/ex1_idaapi.py b/examples/ex1_idaapi.py index 8902ab8..4729554 100644 --- a/examples/ex1_idaapi.py +++ b/examples/ex1_idaapi.py @@ -15,7 +15,14 @@ def main(): seg = getseg(ea) # Loop from segment start to end - func = get_next_func(seg.startEA) + func_ea = seg.startEA + + # Get a function at the start of the segment (if any) + func = get_func(func_ea) + if func is None: + # No function there, try to get the next one + func = get_next_func(func_ea) + seg_end = seg.endEA while func is not None and func.startEA < seg_end: funcea = func.startEA