[Bf-blender-cvs] [8a3a1a0c144] master: Fix T103781: assert when connecting viewer node on mesh without faces

Jacques Lucke noreply at git.blender.org
Tue Jan 10 17:14:55 CET 2023


Commit: 8a3a1a0c14468fd397548378ce4499e566b274a3
Author: Jacques Lucke
Date:   Tue Jan 10 17:13:12 2023 +0100
Branches: master
https://developer.blender.org/rB8a3a1a0c14468fd397548378ce4499e566b274a3

Fix T103781: assert when connecting viewer node on mesh without faces

`Span.data()` does not have to be `nullptr` when the size is zero.
This happens e.g. when slicing a span to a size of zero.

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

M	source/blender/blenlib/BLI_generic_array.hh

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

diff --git a/source/blender/blenlib/BLI_generic_array.hh b/source/blender/blenlib/BLI_generic_array.hh
index 03dc8814309..c46dbe0c907 100644
--- a/source/blender/blenlib/BLI_generic_array.hh
+++ b/source/blender/blenlib/BLI_generic_array.hh
@@ -89,11 +89,8 @@ class GArray {
    */
   GArray(const GSpan span, Allocator allocator = {}) : GArray(span.type(), span.size(), allocator)
   {
-    if (span.data() != nullptr) {
-      BLI_assert(span.size() != 0);
-      /* Use copy assign rather than construct since the memory is already initialized. */
-      type_->copy_assign_n(span.data(), data_, size_);
-    }
+    /* Use copy assign rather than construct since the memory is already initialized. */
+    type_->copy_assign_n(span.data(), data_, size_);
   }
 
   /**



More information about the Bf-blender-cvs mailing list