]> git.ipfire.org Git - thirdparty/Python/cpython.git/commitdiff
Issue #17532: Prevent exception when changing key sets if Options menu is empty.
authorNed Deily <nad@acm.org>
Sat, 20 Jul 2013 21:38:24 +0000 (14:38 -0700)
committerNed Deily <nad@acm.org>
Sat, 20 Jul 2013 21:38:24 +0000 (14:38 -0700)
Lib/idlelib/EditorWindow.py

index 14c76de87ffd3784585a77026525bc0f8fe0c146..5de53a99d9454b9bcd5390ffe547373277b0de90 100644 (file)
@@ -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')