diff options
author | Bastien Montagne <montagne29@wanadoo.fr> | 2019-09-04 16:06:53 +0300 |
---|---|---|
committer | Bastien Montagne <montagne29@wanadoo.fr> | 2019-09-04 16:08:32 +0300 |
commit | d3ab930c880e3a15cd7cd46355663e60119f6bde (patch) | |
tree | e24ac87533e3183d4337bfffff8fbf3e635a4fba /source/blender/makesrna/intern/rna_access.c | |
parent | e08dac5f060b031a9c32f2319a303fc3daf39198 (diff) |
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.
Diffstat (limited to 'source/blender/makesrna/intern/rna_access.c')
-rw-r--r-- | source/blender/makesrna/intern/rna_access.c | 5 |
1 files changed, 4 insertions, 1 deletions
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; } /** |