diff options
author | Philipp Oeser <info@graphics-engineer.com> | 2021-10-21 12:42:16 +0300 |
---|---|---|
committer | Philipp Oeser <info@graphics-engineer.com> | 2021-10-21 15:40:04 +0300 |
commit | 91b4c1841a9b961a7361eb48bd349a674e0b61ae (patch) | |
tree | fd8d065056c11cb2bb1f9623f8eda4de99cd96e1 /source | |
parent | ab0195c78fa20b1c1f8abd1474f0fee07ffb6c8c (diff) |
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
Diffstat (limited to 'source')
-rw-r--r-- | source/blender/makesrna/intern/rna_rigidbody.c | 8 |
1 files changed, 5 insertions, 3 deletions
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; } |