diff options
author | Jacques Lucke <jacques@blender.org> | 2022-07-12 10:42:19 +0300 |
---|---|---|
committer | Jacques Lucke <jacques@blender.org> | 2022-07-12 10:42:19 +0300 |
commit | 6e6da22eb0f48c1189427040d765145766b366c0 (patch) | |
tree | 08b53d76c00c221546039e26c808646b52652f98 /source/blender/blenkernel | |
parent | b8d1e576bcabb4fad42ca9cf8f980240213ac0cf (diff) |
Fix: crash when iterating over all attributes
Diffstat (limited to 'source/blender/blenkernel')
-rw-r--r-- | source/blender/blenkernel/BKE_attribute.hh | 10 |
1 files changed, 7 insertions, 3 deletions
diff --git a/source/blender/blenkernel/BKE_attribute.hh b/source/blender/blenkernel/BKE_attribute.hh index b92d0d4326b..05ab4f1f1f1 100644 --- a/source/blender/blenkernel/BKE_attribute.hh +++ b/source/blender/blenkernel/BKE_attribute.hh @@ -351,8 +351,9 @@ class AttributeAccessor { /** * The data that actually owns the attributes, for example, a pointer to a #Mesh or #PointCloud * Most commonly this is a pointer to a #Mesh or #PointCloud. - * Under some circumstances this can be null. In that case most methods can't be used. Just e.g. - * the #domain_size method works and returns 0 for every domain. + * Under some circumstances this can be null. In that case most methods can't be used. Allowed + * methods are #domain_size, #for_all and #is_builtin. We could potentially make these methods + * accessible without #AttributeAccessor and then #owner_ could always be non-null. * * \note This class cannot modify the owner's attributes, but the pointer is still non-const, so * this class can be a base class for the mutable version. @@ -509,7 +510,10 @@ class AttributeAccessor { */ bool for_all(const AttributeForeachCallback fn) const { - return fn_->for_all(owner_, fn); + if (owner_ != nullptr) { + return fn_->for_all(owner_, fn); + } + return true; } /** |