From 14ef0c8d6bb1794910e815fb3c61d22cc966a49e Mon Sep 17 00:00:00 2001 From: Ned Deily Date: Sat, 20 Jul 2013 14:38:24 -0700 Subject: [PATCH] Issue #17532: Prevent exception when changing key sets if Options menu is empty. --- Lib/idlelib/EditorWindow.py | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/Lib/idlelib/EditorWindow.py b/Lib/idlelib/EditorWindow.py index 14c76de87ff..5de53a99d94 100644 --- a/Lib/idlelib/EditorWindow.py +++ b/Lib/idlelib/EditorWindow.py @@ -833,7 +833,11 @@ class EditorWindow(object): menuEventDict[menu[0]][prepstr(item[0])[1]] = item[1] for menubarItem in self.menudict.keys(): 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')