[Bf-extensions-cvs] [7c36b485] master: Mocap: fix AttributeError when there is no active object

Sybren A. Stüvel noreply at git.blender.org
Mon Jun 15 12:48:56 CEST 2020


Commit: 7c36b48507f79ca62f8c038bad0fb3468c4f48e2
Author: Sybren A. Stüvel
Date:   Mon Jun 15 12:48:27 2020 +0200
Branches: master
https://developer.blender.org/rBAC7c36b48507f79ca62f8c038bad0fb3468c4f48e2

Mocap: fix AttributeError when there is no active object

Two poll functions returned `context.active_object.animation_data` without
checking whether `context.active_object` is `None` or not.

===================================================================

M	mocap/__init__.py

===================================================================

diff --git a/mocap/__init__.py b/mocap/__init__.py
index 98f4fc5b..710db640 100644
--- a/mocap/__init__.py
+++ b/mocap/__init__.py
@@ -596,7 +596,7 @@ class ConvertSamplesOperator(bpy.types.Operator):
 
     @classmethod
     def poll(cls, context):
-        return context.active_object.animation_data
+        return context.active_object and context.active_object.animation_data
 
 
 class LooperOperator(bpy.types.Operator):
@@ -612,7 +612,7 @@ class LooperOperator(bpy.types.Operator):
 
     @classmethod
     def poll(cls, context):
-        return context.active_object.animation_data
+        return context.active_object and context.active_object.animation_data
 
 
 class DenoiseOperator(bpy.types.Operator):



More information about the Bf-extensions-cvs mailing list