From a42208f773e5239a91c7802129d3473ef028418c Mon Sep 17 00:00:00 2001 From: Hugo Saint-Vignes Date: Tue, 5 Jan 2021 16:21:00 +0100 Subject: [PATCH] [apps/shared] Handle null labelStep in numberOfLabels --- apps/shared/curve_view.cpp | 3 +++ 1 file changed, 3 insertions(+) diff --git a/apps/shared/curve_view.cpp b/apps/shared/curve_view.cpp index 1f1b38356..9428d4e98 100644 --- a/apps/shared/curve_view.cpp +++ b/apps/shared/curve_view.cpp @@ -187,6 +187,9 @@ float CurveView::gridUnit(Axis axis) const { int CurveView::numberOfLabels(Axis axis) const { float labelStep = 2.0f * gridUnit(axis); + if (labelStep <= 0.0f) { + return 0; + } float minLabel = std::ceil(min(axis)/labelStep); float maxLabel = std::floor(max(axis)/labelStep); int numberOfLabels = maxLabel - minLabel + 1;