From 6a929c19b82bdf8b9eab810ecacb71bda99ee579 Mon Sep 17 00:00:00 2001 From: Rob Loach Date: Fri, 27 Nov 2026 09:23:54 -0500 Subject: [PATCH] Use NK_ASSERT for zero chart range --- nuklear.h | 4 ++-- src/nuklear_chart.c | 4 ++-- 2 files changed, 4 insertions(+), 4 deletions(-) diff --git a/nuklear.h b/nuklear.h index 7783244b..db56b0f1 100644 --- a/nuklear.h +++ b/nuklear.h @@ -29835,7 +29835,7 @@ nk_chart_begin_colored(struct nk_context *ctx, enum nk_chart_type type, slot->min = NK_MIN(min_value, max_value); slot->max = NK_MAX(min_value, max_value); slot->range = slot->max - slot->min; - if (slot->range <= 0) slot->range = 1.0f; /* avoid division by zero */ + NK_ASSERT(slot->range > 0); /* min and max must differ */ slot->show_markers = style->show_markers;} /* draw chart background */ @@ -29889,7 +29889,7 @@ nk_chart_add_slot_colored(struct nk_context *ctx, const enum nk_chart_type type, slot->min = NK_MIN(min_value, max_value); slot->max = NK_MAX(min_value, max_value); slot->range = slot->max - slot->min; - if (slot->range <= 0) slot->range = 1.0f; /* avoid division by zero */ + NK_ASSERT(slot->range > 0); /* min and max must differ */ slot->show_markers = style->show_markers;} } NK_API void diff --git a/src/nuklear_chart.c b/src/nuklear_chart.c index 5cb8ca53..c67d5456 100644 --- a/src/nuklear_chart.c +++ b/src/nuklear_chart.c @@ -53,7 +53,7 @@ nk_chart_begin_colored(struct nk_context *ctx, enum nk_chart_type type, slot->min = NK_MIN(min_value, max_value); slot->max = NK_MAX(min_value, max_value); slot->range = slot->max - slot->min; - if (slot->range <= 0) slot->range = 1.0f; /* avoid division by zero */ + NK_ASSERT(slot->range > 0); /* min and max must differ */ slot->show_markers = style->show_markers;} /* draw chart background */ @@ -107,7 +107,7 @@ nk_chart_add_slot_colored(struct nk_context *ctx, const enum nk_chart_type type, slot->min = NK_MIN(min_value, max_value); slot->max = NK_MAX(min_value, max_value); slot->range = slot->max - slot->min; - if (slot->range <= 0) slot->range = 1.0f; /* avoid division by zero */ + NK_ASSERT(slot->range > 0); /* min and max must differ */ slot->show_markers = style->show_markers;} } NK_API void