When attempting to add a span that is invalid (zero or negative size), log a warning and ignore the span.

This commit is contained in:
Graham Pentheny
2026-02-08 15:45:42 -05:00
parent 6d30a5d8ee
commit 762ecb5d79
+7
View File
@@ -195,6 +195,13 @@ bool rcAddSpan(rcContext* context, rcHeightfield& heightfield,
{
rcAssert(context);
// Span is zero size or inverted size. Ignore.
if (spanMin >= spanMax)
{
context->log(RC_LOG_WARNING, "rcAddSpan: Adding a span with zero or negative size. Ignored.");
return true;
}
if (!addSpan(heightfield, x, z, spanMin, spanMax, areaID, flagMergeThreshold))
{
context->log(RC_LOG_ERROR, "rcAddSpan: Out of memory.");