[Bf-blender-cvs] [d3ab930c880] master: Fix/cleanup error handling in paths generation for private ID data case.
Bastien Montagne
noreply at git.blender.org
Wed Sep 4 15:08:41 CEST 2019
Commit: d3ab930c880e3a15cd7cd46355663e60119f6bde
Author: Bastien Montagne
Date: Wed Sep 4 15:06:53 2019 +0200
Branches: master
https://developer.blender.org/rBd3ab930c880e3a15cd7cd46355663e60119f6bde
Fix/cleanup error handling in paths generation for private ID data case.
When using new `rna_prepend_real_ID_path()`, caller have to handle the
NULL path case and decide whetehr this is a valid case or an error one.
===================================================================
M source/blender/makesrna/intern/rna_access.c
===================================================================
diff --git a/source/blender/makesrna/intern/rna_access.c b/source/blender/makesrna/intern/rna_access.c
index 61634a84d41..6e98b5f4727 100644
--- a/source/blender/makesrna/intern/rna_access.c
+++ b/source/blender/makesrna/intern/rna_access.c
@@ -5873,6 +5873,7 @@ char *RNA_path_from_real_ID_to_struct(Main *bmain, PointerRNA *ptr, struct ID **
{
char *path = RNA_path_from_ID_to_struct(ptr);
+ /* NULL path is valid in that case, when given struct is an ID one... */
return rna_prepend_real_ID_path(bmain, ptr->owner_id, path, r_real);
}
@@ -5987,7 +5988,9 @@ char *RNA_path_from_real_ID_to_property_index(
{
char *path = RNA_path_from_ID_to_property_index(ptr, prop, index_dim, index);
- return rna_prepend_real_ID_path(bmain, ptr->owner_id, path, r_real_id);
+ /* NULL path is always an error here, in that case do not return the 'fake ID from real ID' part
+ * of the path either. */
+ return path != NULL ? rna_prepend_real_ID_path(bmain, ptr->owner_id, path, r_real_id) : NULL;
}
/**
More information about the Bf-blender-cvs
mailing list