summaryrefslogtreecommitdiff
path: root/src/renderer.cpp
diff options
context:
space:
mode:
authorVasile Vilvoiu <vasi@vilvoiu.ro>2021-07-22 21:11:43 +0300
committerVasile Vilvoiu <vasi@vilvoiu.ro>2021-07-22 21:11:43 +0300
commitbb54f97810284770f827af6d3d6f9417d8d318ca (patch)
tree1f5173097c23ce6a9fdd4cd94353c1a97830aaba /src/renderer.cpp
parentaa91ba3ab50320d9f3cf9b41a68d9c001f769df6 (diff)
Handle very small axes, when no nice value is found.
Fixes #23.
Diffstat (limited to 'src/renderer.cpp')
-rw-r--r--src/renderer.cpp8
1 files changed, 6 insertions, 2 deletions
diff --git a/src/renderer.cpp b/src/renderer.cpp
index 4337bbf..5285c63 100644
--- a/src/renderer.cpp
+++ b/src/renderer.cpp
@@ -381,8 +381,12 @@ Renderer::GetNiceTicks(double v_min, double v_max, const std::string& v_unit, un
fval = std::floor(fval) + 1.0f;
}
fval *= factor;
- assert(v_min <= fval);
- assert(fval <= v_max);
+
+ if ((fval < v_min) || (fval > v_max)) {
+ /* there is no nice value here; usually this happens because the
+ * axis length is too small */
+ return v_min;
+ }
return fval;
};