Skip to content

Commit 915e7bc

Browse files
authored
Merge pull request #3 from sysprog21/fix_leaving_menu
Avoid crashing when leaving menu not in parent
2 parents 121c88e + 5fb7123 commit 915e7bc

File tree

1 file changed

+8
-1
lines changed

1 file changed

+8
-1
lines changed

menuconfig.py

Lines changed: 8 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1207,7 +1207,14 @@ def _leave_menu():
12071207
# Jump to parent menu
12081208
parent = _parent_menu(_cur_menu)
12091209
_shown = _shown_nodes(parent)
1210-
_sel_node_i = _shown.index(_cur_menu)
1210+
1211+
try:
1212+
_sel_node_i = _shown.index(_cur_menu)
1213+
except ValueError:
1214+
# The parent actually does not contain the current menu (e.g., symbol
1215+
# search). So we jump to the first node instead.
1216+
_sel_node_i = 0
1217+
12111218
_cur_menu = parent
12121219

12131220
# Try to make the menu entry appear on the same row on the screen as it did

0 commit comments

Comments
 (0)