[Bf-blender-cvs] [c323f3e90a4] blender-v2.90-release: Fix T77548: Crash when using Add Object Tool with Normal Orientation and zero objects in scene

Deep Majumder noreply at git.blender.org
Wed Aug 5 20:46:40 CEST 2020


Commit: c323f3e90a4a0d15e7d9e844e0473ed62a25862f
Author: Deep Majumder
Date:   Wed Aug 5 15:34:12 2020 -0300
Branches: blender-v2.90-release
https://developer.blender.org/rBc323f3e90a4a0d15e7d9e844e0473ed62a25862f

Fix T77548: Crash when using Add Object Tool with Normal Orientation and zero objects in scene

The crash is caused by the fact that a NULL Object pointer is passed to
calculate the transform orientation, which has been set to normal.

A check has been include to detect the same.

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

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

M	source/blender/editors/transform/transform_orientations.c

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

diff --git a/source/blender/editors/transform/transform_orientations.c b/source/blender/editors/transform/transform_orientations.c
index 493b52495db..e805743e6bb 100644
--- a/source/blender/editors/transform/transform_orientations.c
+++ b/source/blender/editors/transform/transform_orientations.c
@@ -467,14 +467,14 @@ short ED_transform_calc_orientation_from_type_ex(const bContext *C,
       return V3D_ORIENT_GLOBAL;
     }
     case V3D_ORIENT_GIMBAL: {
-      if (gimbal_axis(ob, r_mat)) {
+      if (ob && gimbal_axis(ob, r_mat)) {
         return V3D_ORIENT_GIMBAL;
       }
       /* if not gimbal, fall through to normal */
       ATTR_FALLTHROUGH;
     }
     case V3D_ORIENT_NORMAL: {
-      if (obedit || ob->mode & OB_MODE_POSE) {
+      if (obedit || (ob && ob->mode & OB_MODE_POSE)) {
         ED_getTransformOrientationMatrix(C, r_mat, pivot_point);
         return V3D_ORIENT_NORMAL;
       }



More information about the Bf-blender-cvs mailing list