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.
This commit is contained in:
Jacques Lucke 2023-01-10 17:13:12 +01:00
parent db688b62f9
commit 8a3a1a0c14
Notes: blender-bot 2023-02-13 13:37:03 +01:00
Referenced by issue #103781, Assert when connecting viewer node on mesh without faces.
1 changed files with 2 additions and 5 deletions

View File

@ -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_);
}
/**