[Bf-blender-cvs] [c5558b3] blender-v2.78-release: Fix crash in own recent rB776a8548f03a049.

Bastien Montagne noreply at git.blender.org
Mon Sep 26 10:54:10 CEST 2016


Commit: c5558b3ccdfee60a9fddb61bf3c3641746ed73b3
Author: Bastien Montagne
Date:   Mon Sep 26 09:49:34 2016 +0200
Branches: blender-v2.78-release
https://developer.blender.org/rBc5558b3ccdfee60a9fddb61bf3c3641746ed73b3

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.

===================================================================

M	source/blender/blenkernel/intern/sca.c

===================================================================

diff --git a/source/blender/blenkernel/intern/sca.c b/source/blender/blenkernel/intern/sca.c
index c357b2e..61aa8c7 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;




More information about the Bf-blender-cvs mailing list