[Bf-extensions-cvs] [0fc4f026] blender-v3.4-release: Fix T99623: exception in pose library when the path to the library is missing

Ayoub ibn Muhammad noreply at git.blender.org
Mon Nov 28 12:56:42 CET 2022


Commit: 0fc4f02650c50691d9749a9f1e1fb12c690b73db
Author: Ayoub ibn Muhammad
Date:   Mon Nov 28 12:54:42 2022 +0100
Branches: blender-v3.4-release
https://developer.blender.org/rBA0fc4f02650c50691d9749a9f1e1fb12c690b73db

Fix T99623: exception in pose library when the path to the library is missing

Add check if `context.copy` is not `None`, before trying to call it.

When the path to the asset library points to a non-existing directory,
`context.copy` is set to `None`; when the code reaches `return
bpy.ops.poselib.apply_pose_asset.poll(context.copy())` in the `poll`
method of the class `POSELIB_OT_apply_pose_asset_for_keymap`, it throws
an exception since `None` is not callable.

Reviewed By: sybren

Maniphest Tasks: T99623

Differential Revision: https://developer.blender.org/D15427

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

M	pose_library/operators.py

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

diff --git a/pose_library/operators.py b/pose_library/operators.py
index 73fca59d..08f7c56a 100644
--- a/pose_library/operators.py
+++ b/pose_library/operators.py
@@ -428,6 +428,10 @@ class POSELIB_OT_apply_pose_asset_for_keymap(Operator):
 
     @classmethod
     def poll(cls, context: Context) -> bool:
+        if context.copy is None:
+            # This can happen when the asset browser is configured with a
+            # non-existing asset library path.
+            return False
         if not asset_utils.SpaceAssetInfo.is_asset_browser(context.space_data):
             return False
         return bpy.ops.poselib.apply_pose_asset.poll(context.copy())



More information about the Bf-extensions-cvs mailing list