From fa50edc999c1ef2aa76e5c3a74fd5d8789fcb8bf Mon Sep 17 00:00:00 2001 From: Jacques Lucke Date: Thu, 1 Apr 2021 12:25:30 +0200 Subject: BLI: return early when copying empty array --- source/blender/blenlib/BLI_linear_allocator.hh | 3 +++ 1 file changed, 3 insertions(+) (limited to 'source/blender/blenlib/BLI_linear_allocator.hh') diff --git a/source/blender/blenlib/BLI_linear_allocator.hh b/source/blender/blenlib/BLI_linear_allocator.hh index 47705b1d40b..6aa97d5c5e7 100644 --- a/source/blender/blenlib/BLI_linear_allocator.hh +++ b/source/blender/blenlib/BLI_linear_allocator.hh @@ -133,6 +133,9 @@ template class LinearAllocator : NonCopya */ template MutableSpan construct_array_copy(Span src) { + if (src.is_empty()) { + return {}; + } MutableSpan dst = this->allocate_array(src.size()); uninitialized_copy_n(src.data(), src.size(), dst.data()); return dst; -- cgit v1.2.3