[Bf-blender-cvs] [91b4c1841a9] master: Fix T92272: Rigid Body Copy to Selected "Margin" crash

Philipp Oeser noreply at git.blender.org
Thu Oct 21 14:45:45 CEST 2021


Commit: 91b4c1841a9b961a7361eb48bd349a674e0b61ae
Author: Philipp Oeser
Date:   Thu Oct 21 11:42:16 2021 +0200
Branches: master
https://developer.blender.org/rB91b4c1841a9b961a7361eb48bd349a674e0b61ae

Fix T92272: Rigid Body Copy to Selected "Margin" crash

Caused by {rB43167a2c251b}

Code from above commit called RNA updates with a NULL scene.
This was already commented (and mostly handled) in rB5949d598bc33, but
the reported case was missing in that commit.

This fixes the crash in a similar manner as rB5949d598bc33.

Maniphest Tasks: T92272

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

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

M	source/blender/makesrna/intern/rna_rigidbody.c

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

diff --git a/source/blender/makesrna/intern/rna_rigidbody.c b/source/blender/makesrna/intern/rna_rigidbody.c
index c51931d0d1a..c0fb904101d 100644
--- a/source/blender/makesrna/intern/rna_rigidbody.c
+++ b/source/blender/makesrna/intern/rna_rigidbody.c
@@ -233,10 +233,12 @@ static void rna_RigidBodyOb_shape_update(Main *bmain, Scene *scene, PointerRNA *
 
 static void rna_RigidBodyOb_shape_reset(Main *UNUSED(bmain), Scene *scene, PointerRNA *ptr)
 {
-  RigidBodyWorld *rbw = scene->rigidbody_world;
-  RigidBodyOb *rbo = (RigidBodyOb *)ptr->data;
+  if (scene != NULL) {
+    RigidBodyWorld *rbw = scene->rigidbody_world;
+    BKE_rigidbody_cache_reset(rbw);
+  }
 
-  BKE_rigidbody_cache_reset(rbw);
+  RigidBodyOb *rbo = (RigidBodyOb *)ptr->data;
   if (rbo->shared->physics_shape) {
     rbo->flag |= RBO_FLAG_NEEDS_RESHAPE;
   }



More information about the Bf-blender-cvs mailing list