]> 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 22:06:26 +0000 (15:06 -0700)
committerNed Deily <nad@acm.org>
Sat, 20 Jul 2013 22:06:26 +0000 (15:06 -0700)
Lib/idlelib/EditorWindow.py

index fd2f11dadd99d3034dda8cad219f5d3f43eded03..24f133fa9b19ba4e7b10838c73d5f8e56887b113 100644 (file)
@@ -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')