Fix potential crash opening 3.0 blend files in older versions.

Affects insertion of constraints or NLA tracks in liboverrides. In some
cases, when opening newer post-3.0 .blend files, the source won't be
found anymore, override apply code then needs to fail properly instead
of crashing.

Related to refactor from  rB33c5e7bcd5e5.
This commit is contained in:
Bastien Montagne 2021-11-22 14:27:02 +01:00
parent 0b89b94947
commit 1d8d6c2f62
Notes: blender-bot 2023-02-14 06:00:44 +01:00
Referenced by issue #88449: Blender LTS: Maintenance Task 2.93
Referenced by issue #88449, Blender LTS: Maintenance Task 2.93
Referenced by issue #82160, LibOverrides - Refactor how diffing of RNA collections is handled, and extend diffing possibilities.
2 changed files with 8 additions and 2 deletions

View File

@ -775,7 +775,10 @@ bool rna_NLA_tracks_override_apply(Main *bmain,
}
nla_track_src = nla_track_src ? nla_track_src->next : anim_data_src->nla_tracks.first;
BLI_assert(nla_track_src != NULL);
if (nla_track_src == NULL) {
BLI_assert(nla_track_src != NULL);
return false;
}
NlaTrack *nla_track_dst = BKE_nlatrack_copy(bmain, nla_track_src, true, 0);

View File

@ -1601,7 +1601,10 @@ bool rna_Object_constraints_override_apply(Main *UNUSED(bmain),
}
con_src = con_src ? con_src->next : ob_src->constraints.first;
BLI_assert(con_src != NULL);
if (con_src == NULL) {
BLI_assert(con_src != NULL);
return false;
}
bConstraint *con_dst = BKE_constraint_duplicate_ex(con_src, 0, true);