Fix T70695: Scene crashes Blender on open.

Note that this commit fixes the crash itself, but actual issue is *how*
that situation could happen (having insert override operation with local
'source' overriding data-block with an empty bone constraints stack...).
This commit is contained in:
Bastien Montagne 2019-10-11 16:18:37 +02:00
parent b57a89f062
commit 1e5e65fa9f
1 changed files with 6 additions and 2 deletions

View File

@ -648,7 +648,7 @@ bool rna_PoseChannel_constraints_override_apply(Main *UNUSED(bmain),
/* Remember that insertion operations are defined and stored in correct order, which means that
* even if we insert several items in a row, we always insert first one, then second one, etc.
* So we should always find 'anchor' constraint in both _src *and* _dst> */
* So we should always find 'anchor' constraint in both _src *and* _dst */
bConstraint *con_anchor = NULL;
if (opop->subitem_local_name && opop->subitem_local_name[0]) {
con_anchor = BLI_findstring(
@ -669,7 +669,11 @@ bool rna_PoseChannel_constraints_override_apply(Main *UNUSED(bmain),
}
con_src = con_src ? con_src->next : pchan_src->constraints.first;
BLI_assert(con_src != NULL);
if (con_src == NULL) {
printf("%s: Could not find constraint to insert, doing nothing...\n", __func__);
BLI_assert(0);
return false;
}
bConstraint *con_dst = BKE_constraint_duplicate_ex(con_src, 0, true);