Prevent crash if nsp is evaluated to 0

This commit is contained in:
Holger Vogt 2022-02-21 16:56:16 +01:00
parent 20abe9ca38
commit 0557bc60bf
1 changed files with 2 additions and 0 deletions

View File

@ -633,6 +633,8 @@ lingrid(GRAPH *graph, double lo, double hi, double delta, int type, Axis axis)
nsp = (int)((hi - lo) / delta);
if (nsp > 100)
nsp = 100;
if (nsp < 1)
nsp = 1;
}
spacing = (max - margin) / nsp;