Fix crash in liboverride/pointcache handling code after recent changes.

In some cases code would try to access NULL pointer.

Reported by @dfelinto, thanks.
This commit is contained in:
Bastien Montagne 2021-10-26 10:13:44 +02:00
parent 7bc7d1747c
commit 9ba22bd1f7
1 changed files with 8 additions and 4 deletions

View File

@ -1159,10 +1159,14 @@ static void object_lib_override_apply_post(ID *id_dst, ID *id_src)
for (pid_dst = pidlist_dst.first, pid_src = pidlist_src.first; pid_dst != NULL;
pid_dst = pid_dst->next, pid_src = (pid_src != NULL) ? pid_src->next : NULL) {
/* If pid's do not match, just tag info of caches in dst as dirty and continue. */
if (pid_src == NULL || pid_dst->type != pid_src->type ||
pid_dst->file_type != pid_src->file_type ||
pid_dst->default_step != pid_src->default_step || pid_dst->max_step != pid_src->max_step ||
pid_dst->data_types != pid_src->data_types || pid_dst->info_types != pid_src->info_types) {
if (pid_src == NULL) {
continue;
}
else if (pid_dst->type != pid_src->type || pid_dst->file_type != pid_src->file_type ||
pid_dst->default_step != pid_src->default_step ||
pid_dst->max_step != pid_src->max_step ||
pid_dst->data_types != pid_src->data_types ||
pid_dst->info_types != pid_src->info_types) {
LISTBASE_FOREACH (PointCache *, point_cache_src, pid_src->ptcaches) {
point_cache_src->flag |= PTCACHE_FLAG_INFO_DIRTY;
}