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
This commit is contained in:
Philipp Oeser 2021-10-21 11:42:16 +02:00
parent ab0195c78f
commit 91b4c1841a
Notes: blender-bot 2023-04-19 22:54:54 +02:00
Referenced by issue #92272, Rigid Body - Copy to Selected "Margin" make crash Blender 3.0
1 changed files with 5 additions and 3 deletions

View File

@ -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;
}