From: Ned Deily Date: Sat, 20 Jul 2013 22:06:26 +0000 (-0700) Subject: Issue #17532: Prevent exception when changing key sets if Options menu is empty. X-Git-Tag: v3.4.0a1~123^2^2 X-Git-Url: http://git.ipfire.org/gitweb.cgi?a=commitdiff_plain;h=8e8b9ba753bf2ada822aff95f19be7a0a85c312e;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 fd2f11dadd99..24f133fa9b19 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')