Fix: OffsetIndices assert with invalid span

In some cases (when there are no faces for example, the offsets span
can have a size of 1 but no data). That's technically invalid and might
need to be addressed more later on, but for now, just fix the assert.
This commit is contained in:
Hans Goudey
2023-06-12 08:27:44 -04:00
parent d75be31b18
commit 107c5e39aa

View File

@@ -32,7 +32,7 @@ template<typename T> class OffsetIndices {
OffsetIndices() = default;
OffsetIndices(const Span<T> offsets) : offsets_(offsets)
{
BLI_assert(std::is_sorted(offsets_.begin(), offsets_.end()));
BLI_assert(offsets_.size() < 2 || std::is_sorted(offsets_.begin(), offsets_.end()));
}
/** Return the total number of elements in the referenced arrays. */