diff options
author | Bastien Montagne <montagne29@wanadoo.fr> | 2016-09-26 10:49:34 +0300 |
---|---|---|
committer | Bastien Montagne <montagne29@wanadoo.fr> | 2016-09-26 10:49:34 +0300 |
commit | 7c532601090c6e5a09484a0f8a39467856a8d6f4 (patch) | |
tree | 60d4b17b46568fc4f0a8020292e03910eae5f6fd /source | |
parent | 07de832e22f5052d042605fdf3f8161a213c4f80 (diff) |
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.
Diffstat (limited to 'source')
-rw-r--r-- | source/blender/blenkernel/intern/sca.c | 9 |
1 files changed, 5 insertions, 4 deletions
diff --git a/source/blender/blenkernel/intern/sca.c b/source/blender/blenkernel/intern/sca.c index c357b2ef9f7..61aa8c7589f 100644 --- a/source/blender/blenkernel/intern/sca.c +++ b/source/blender/blenkernel/intern/sca.c @@ -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; |