From: Ned Deily Date: Sat, 20 Jul 2013 21:38:24 +0000 (-0700) Subject: Issue #17532: Prevent exception when changing key sets if Options menu is empty. X-Git-Tag: v2.7.6rc1~290 X-Git-Url: http://git.ipfire.org/gitweb.cgi?a=commitdiff_plain;h=14ef0c8d6bb1794910e815fb3c61d22cc966a49e;p=thirdparty%2FPython%2Fcpython.git Issue #17532: Prevent exception when changing key sets if Options menu is empty. --- diff --git a/Lib/idlelib/EditorWindow.py b/Lib/idlelib/EditorWindow.py index 14c76de87ffd..5de53a99d945 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')