Fix keymap operator polling functions to be a bit safer.
authorMartin Poirier <theeth@yahoo.com>
Mon, 7 Mar 2011 23:53:08 +0000 (23:53 +0000)
committerMartin Poirier <theeth@yahoo.com>
Mon, 7 Mar 2011 23:53:08 +0000 (23:53 +0000)
release/scripts/ui/space_userpref_keymap.py

index 9e338aade1c8c3b6c3ea26c67d97f667772140dc..60bd89db60aed20a6f5933216c41d58ec6df8fcf 100644 (file)
@@ -710,8 +710,7 @@ class WM_OT_keyitem_restore(bpy.types.Operator):
 
     @classmethod
     def poll(cls, context):
-        km = context.keymap
-        return km.is_user_defined
+        return hasattr(context, "keymap") and context.keymap.is_user_defined
 
     def execute(self, context):
         km = context.keymap
@@ -756,8 +755,7 @@ class WM_OT_keyitem_remove(bpy.types.Operator):
 
     @classmethod
     def poll(cls, context):
-        km = context.keymap
-        return km.is_user_defined
+        return hasattr(context, "keymap") and context.keymap.is_user_defined
 
     def execute(self, context):
         km = context.keymap