Fix T75991: crash when rigidbody encounters unknown constraint type

This just adds a check to prevent the crash,
Versioning invalid types still needed.
This commit is contained in:
Campbell Barton 2020-04-23 11:28:32 +10:00
parent a68bd94d11
commit c632396733
Notes: blender-bot 2023-02-14 10:04:50 +01:00
Referenced by issue #75991, Blender crashes when opening file with RigidBodyConstraints from pre-2.83
1 changed files with 5 additions and 0 deletions

View File

@ -1027,6 +1027,11 @@ static void rigidbody_validate_sim_constraint(RigidBodyWorld *rbw, Object *ob, b
return;
}
/* When 'rbc->type' is unknown. */
if (rbc->physics_constraint == NULL) {
return;
}
RB_constraint_set_enabled(rbc->physics_constraint, rbc->flag & RBC_FLAG_ENABLED);
if (rbc->flag & RBC_FLAG_USE_BREAKING) {