[Bf-blender-cvs] [834523e2391] master: Cleanup/Fix RNA array length accessors returning non-zero values in invalid cases.

Bastien Montagne noreply at git.blender.org
Thu Aug 5 17:21:40 CEST 2021


Commit: 834523e2391b3c8dab393daa040e135d7b729f86
Author: Bastien Montagne
Date:   Thu Aug 5 16:48:16 2021 +0200
Branches: master
https://developer.blender.org/rB834523e2391b3c8dab393daa040e135d7b729f86

Cleanup/Fix RNA array length accessors returning non-zero values in invalid cases.

This was apparently done in two places only, with a very cryptic comment
(`/* for raw_access, untested */`), and... I cannot see how returning a
non-zero length value for an array that does not exist or is not
accessible at least, would be anything but an obvious source of issues.

Note that both commits adding those lines are from stone ages (2009):
rBcbc2c1886dee and rB50e3bb7f5f34.

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

M	source/blender/makesrna/intern/rna_constraint.c
M	source/blender/makesrna/intern/rna_fcurve.c

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

diff --git a/source/blender/makesrna/intern/rna_constraint.c b/source/blender/makesrna/intern/rna_constraint.c
index 3064703b02e..a0a0a41b58d 100644
--- a/source/blender/makesrna/intern/rna_constraint.c
+++ b/source/blender/makesrna/intern/rna_constraint.c
@@ -715,7 +715,7 @@ static int rna_SplineIKConstraint_joint_bindings_get_length(PointerRNA *ptr,
     length[0] = ikData->numpoints;
   }
   else {
-    length[0] = 256; /* for raw_access, untested */
+    length[0] = 0;
   }
 
   return length[0];
diff --git a/source/blender/makesrna/intern/rna_fcurve.c b/source/blender/makesrna/intern/rna_fcurve.c
index 1f187382980..a38bbd3d6d2 100644
--- a/source/blender/makesrna/intern/rna_fcurve.c
+++ b/source/blender/makesrna/intern/rna_fcurve.c
@@ -809,7 +809,7 @@ static int rna_FModifierGenerator_coefficients_get_length(PointerRNA *ptr,
     length[0] = gen->arraysize;
   }
   else {
-    length[0] = 100; /* for raw_access, untested */
+    length[0] = 0;
   }
 
   return length[0];



More information about the Bf-blender-cvs mailing list