Fix crash in own recent rB776a8548f03a049.

New ID may be null, have to check this too!

Reported by @panzergame over IRC, thanks.

To be ported to 2.78 as well.
This commit is contained in:
Bastien Montagne 2016-09-26 09:49:34 +02:00
parent 07de832e22
commit 7c53260109
Notes: blender-bot 2023-02-14 07:34:00 +01:00
Referenced by issue #49750, Cycles - Bump Mapping - Bump Mapping  has weird line based of Camera clipping
Referenced by issue #49458, FBX and Alembic export does not support instances anymore
1 changed files with 5 additions and 4 deletions

View File

@ -666,15 +666,16 @@ void set_sca_new_poins(void)
* ...and forces us to add yet another very ugly hack to get remapping with logic bricks working. */
void BKE_sca_logic_links_remap(Main *bmain, Object *ob_old, Object *ob_new)
{
if (ob_new == NULL || (ob_old->controllers.first == NULL && ob_old->actuators.first == NULL)) {
/* Nothing to do here... */
return;
}
GHash *controllers_map = ob_old->controllers.first ?
BLI_ghash_ptr_new_ex(__func__, BLI_listbase_count(&ob_old->controllers)) : NULL;
GHash *actuators_map = ob_old->actuators.first ?
BLI_ghash_ptr_new_ex(__func__, BLI_listbase_count(&ob_old->actuators)) : NULL;
if (!(controllers_map || actuators_map)) {
return;
}
/* We try to remap old controllers/actuators to new ones - in a very basic way. */
for (bController *cont_old = ob_old->controllers.first, *cont_new = ob_new->controllers.first;
cont_old;