diff options
author | Jacques Lucke <jacques@blender.org> | 2022-07-07 20:27:30 +0300 |
---|---|---|
committer | Jacques Lucke <jacques@blender.org> | 2022-07-07 20:27:30 +0300 |
commit | 4e9e44ad28fc7a48e0d74a9f752847eb7be4e662 (patch) | |
tree | c96ee03859089efd18886676af718995ea8a0b84 /source/blender/blenlib | |
parent | ba62e20af67e1de25f781456df7175fa1b31db67 (diff) |
Cleanup: improve asserts in generic span
Diffstat (limited to 'source/blender/blenlib')
-rw-r--r-- | source/blender/blenlib/BLI_generic_span.hh | 6 |
1 files changed, 4 insertions, 2 deletions
diff --git a/source/blender/blenlib/BLI_generic_span.hh b/source/blender/blenlib/BLI_generic_span.hh index 0a40201634a..143ab235d2e 100644 --- a/source/blender/blenlib/BLI_generic_span.hh +++ b/source/blender/blenlib/BLI_generic_span.hh @@ -28,7 +28,8 @@ class GSpan { { BLI_assert(size >= 0); BLI_assert(buffer != nullptr || size == 0); - BLI_assert(type->pointer_has_valid_alignment(buffer)); + BLI_assert(size == 0 || type != nullptr); + BLI_assert(type == nullptr || type->pointer_has_valid_alignment(buffer)); } GSpan(const CPPType &type, const void *buffer, int64_t size) : GSpan(&type, buffer, size) @@ -119,7 +120,8 @@ class GMutableSpan { { BLI_assert(size >= 0); BLI_assert(buffer != nullptr || size == 0); - BLI_assert(type->pointer_has_valid_alignment(buffer)); + BLI_assert(size == 0 || type != nullptr); + BLI_assert(type == nullptr || type->pointer_has_valid_alignment(buffer)); } GMutableSpan(const CPPType &type, void *buffer, int64_t size) : GMutableSpan(&type, buffer, size) |