[Bf-blender-cvs] [101fd7ec063] master: Tweak new BKE_id_is_in_global_main to accept NULL pointer (and consider them as valid).

Bastien Montagne noreply at git.blender.org
Fri Jun 22 12:37:08 CEST 2018


Commit: 101fd7ec0639c03ab017e90cb46367f50e512cbb
Author: Bastien Montagne
Date:   Fri Jun 22 12:26:45 2018 +0200
Branches: master
https://developer.blender.org/rB101fd7ec0639c03ab017e90cb46367f50e512cbb

Tweak new BKE_id_is_in_global_main to accept NULL pointer (and consider them as valid).

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

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

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

diff --git a/source/blender/blenkernel/intern/library.c b/source/blender/blenkernel/intern/library.c
index 444e155f5ac..00c542bcd4a 100644
--- a/source/blender/blenkernel/intern/library.c
+++ b/source/blender/blenkernel/intern/library.c
@@ -2418,6 +2418,7 @@ void BKE_id_tag_clear_atomic(ID *id, int tag)
 /** Check that given ID pointer actually is in G_MAIN.
  * Main intended use is for debug asserts in places we cannot easily get rid of G_Main... */
 bool BKE_id_is_in_gobal_main(ID *id) {
-	return (BLI_findindex(which_libbase(G_MAIN, GS(id->name)), id) != -1);
+	/* We do not want to fail when id is NULL here, even though this is a bit strange behavior... */
+	return (id == NULL || BLI_findindex(which_libbase(G_MAIN, GS(id->name)), id) != -1);
 }



More information about the Bf-blender-cvs mailing list