fix for py/rna mesh.materials[:] where empty materials exist, would raise a runtime...
[blender-staging.git] / source / blender / makesrna / intern / rna_access.c
index 23b96926fc02df5c015842943d093dd406e4be9f..ce80bb6c6ed9cf63348dbf5ff80bbc44c88cafe4 100644 (file)
@@ -2302,8 +2302,7 @@ int RNA_property_collection_lookup_int(PointerRNA *ptr, PropertyRNA *prop, int k
 
        if(cprop->lookupint) {
                /* we have a callback defined, use it */
-               *r_ptr= cprop->lookupint(ptr, key);
-               return (r_ptr->data != NULL);
+               return cprop->lookupint(ptr, key, r_ptr);
        }
        else {
                /* no callback defined, just iterate and find the nth item */
@@ -2332,8 +2331,7 @@ int RNA_property_collection_lookup_string(PointerRNA *ptr, PropertyRNA *prop, co
 
        if(cprop->lookupstring) {
                /* we have a callback defined, use it */
-               *r_ptr= cprop->lookupstring(ptr, key);
-               return (r_ptr->data != NULL);
+               return cprop->lookupstring(ptr, key, r_ptr);
        }
        else {
                /* no callback defined, compare with name properties if they exist */