summaryrefslogtreecommitdiff
path: root/Lib/idlelib
diff options
context:
space:
mode:
authorNed Deily <nad@acm.org>2013-07-20 15:06:26 -0700
committerNed Deily <nad@acm.org>2013-07-20 15:06:26 -0700
commitf3d0485ad850b99c00956218ec78c92ebfba8753 (patch)
tree455c6acc2fd2f5f75581b755dd126617ea0a3e59 /Lib/idlelib
parent1cb04c0bb123b34869633258a771156e9c6444ed (diff)
downloadcpython-f3d0485ad850b99c00956218ec78c92ebfba8753.tar.gz
Issue #17532: Prevent exception when changing key sets if Options menu is empty.
Diffstat (limited to 'Lib/idlelib')
-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 fd2f11dadd..24f133fa9b 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')