1
0
Fork 0
mirror of https://github.com/gwm17/implot.git synced 2024-11-26 12:18:52 -05:00

Replace assert with clamp in SetupAxisTicks

This commit is contained in:
Evan Pezent 2022-09-17 10:20:20 -05:00
parent f719a180ff
commit 921a81f307

View File

@ -2162,7 +2162,7 @@ void SetupAxisTicks(ImAxis idx, const double* values, int n_ticks, const char* c
void SetupAxisTicks(ImAxis idx, double v_min, double v_max, int n_ticks, const char* const labels[], bool show_default) { void SetupAxisTicks(ImAxis idx, double v_min, double v_max, int n_ticks, const char* const labels[], bool show_default) {
IM_ASSERT_USER_ERROR(GImPlot->CurrentPlot != NULL && !GImPlot->CurrentPlot->SetupLocked, IM_ASSERT_USER_ERROR(GImPlot->CurrentPlot != NULL && !GImPlot->CurrentPlot->SetupLocked,
"Setup needs to be called after BeginPlot and before any setup locking functions (e.g. PlotX)!"); "Setup needs to be called after BeginPlot and before any setup locking functions (e.g. PlotX)!");
IM_ASSERT_USER_ERROR(n_ticks > 1, "The number of ticks must be greater than 1"); n_ticks = ImClamp(n_ticks, 2, n_ticks);
FillRange(GImPlot->TempDouble1, n_ticks, v_min, v_max); FillRange(GImPlot->TempDouble1, n_ticks, v_min, v_max);
SetupAxisTicks(idx, GImPlot->TempDouble1.Data, n_ticks, labels, show_default); SetupAxisTicks(idx, GImPlot->TempDouble1.Data, n_ticks, labels, show_default);
} }