summaryrefslogtreecommitdiffstats
path: root/Lib
diff options
context:
space:
mode:
authorNed Deily <nad@acm.org>2013-07-20 22:06:26 (GMT)
committerNed Deily <nad@acm.org>2013-07-20 22:06:26 (GMT)
commit8e8b9ba753bf2ada822aff95f19be7a0a85c312e (patch)
treee7c411a390f659bb9b840fd27c16364c2968a465 /Lib
parenta6404ad43c11d04909a9e01f85559e1b52e616b4 (diff)
downloadcpython-8e8b9ba753bf2ada822aff95f19be7a0a85c312e.zip
cpython-8e8b9ba753bf2ada822aff95f19be7a0a85c312e.tar.gz
cpython-8e8b9ba753bf2ada822aff95f19be7a0a85c312e.tar.bz2
Issue #17532: Prevent exception when changing key sets if Options menu is empty.
Diffstat (limited to 'Lib')
-rw-r--r--Lib/idlelib/EditorWindow.py6
1 files changed, 5 insertions, 1 deletions
diff --git a/Lib/idlelib/EditorWindow.py b/Lib/idlelib/EditorWindow.py
index fd2f11d..24f133f 100644
--- a/Lib/idlelib/EditorWindow.py
+++ b/Lib/idlelib/EditorWindow.py
@@ -821,7 +821,11 @@ class EditorWindow(object):
menuEventDict[menu[0]][prepstr(item[0])[1]] = item[1]
for menubarItem in self.menudict:
menu = self.menudict[menubarItem]
- end = menu.index(END) + 1
+ end = menu.index(END)
+ if end is None:
+ # Skip empty menus
+ continue
+ end += 1
for index in range(0, end):
if menu.type(index) == 'command':
accel = menu.entrycget(index, 'accelerator')