diff options
author | Jacques Lucke <jacques@blender.org> | 2021-04-01 13:25:30 +0300 |
---|---|---|
committer | Jacques Lucke <jacques@blender.org> | 2021-04-01 13:38:14 +0300 |
commit | fa50edc999c1ef2aa76e5c3a74fd5d8789fcb8bf (patch) | |
tree | a673b05f45cdcd5682bd3acf2786e333d2c9f3b0 /source/blender/blenlib | |
parent | 0ffbcc44168dc3b2058a16648775c874dce89727 (diff) |
BLI: return early when copying empty array
Diffstat (limited to 'source/blender/blenlib')
-rw-r--r-- | source/blender/blenlib/BLI_linear_allocator.hh | 3 |
1 files changed, 3 insertions, 0 deletions
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<typename Allocator = GuardedAllocator> class LinearAllocator : NonCopya */ template<typename T> MutableSpan<T> construct_array_copy(Span<T> src) { + if (src.is_empty()) { + return {}; + } MutableSpan<T> dst = this->allocate_array<T>(src.size()); uninitialized_copy_n(src.data(), src.size(), dst.data()); return dst; |