Skip to content

Commit ce6d1d2

Browse files
committed
better handling when IL header selected
1 parent 4e7196a commit ce6d1d2

File tree

1 file changed

+12
-6
lines changed

1 file changed

+12
-6
lines changed

__init__.py

Lines changed: 12 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -169,12 +169,18 @@ def setupGlobals(uiactioncontext, uicontext):
169169
il_start = view.getSelectionStartILInstructionIndex()
170170

171171
snippetGlobals['current_il_function'] = active_il_function
172-
snippetGlobals['current_il_instruction'] = active_il_function[active_il_index]
173-
snippetGlobals["current_il_basic_block"] = active_il_function[active_il_index].il_basic_block
174-
snippetGlobals['current_il_instructions'] = (active_il_function[i] for i in range(
175-
min(il_start, active_il_index),
176-
max(il_start, active_il_index) + 1)
177-
)
172+
if active_il_index == 0xffffffffffffffff:
173+
# Invalid index
174+
snippetGlobals['current_il_instruction'] = None
175+
snippetGlobals["current_il_basic_block"] = None
176+
snippetGlobals['current_il_instructions'] = None
177+
else:
178+
snippetGlobals['current_il_instruction'] = active_il_function[active_il_index]
179+
snippetGlobals["current_il_basic_block"] = active_il_function[active_il_index].il_basic_block
180+
snippetGlobals['current_il_instructions'] = (active_il_function[i] for i in range(
181+
min(il_start, active_il_index),
182+
max(il_start, active_il_index) + 1)
183+
)
178184
else:
179185
snippetGlobals['current_il_function'] = None
180186
snippetGlobals['current_il_instruction'] = None

0 commit comments

Comments
 (0)