[RFPlot] Prevent under/overflow of selection buffer
parent
0177a2d38f
commit
cbfd40931b
22
rfplot.c
22
rfplot.c
|
@ -384,11 +384,15 @@ int main(int argc,char *argv[])
|
||||||
|
|
||||||
// Select start
|
// Select start
|
||||||
if (c=='s') {
|
if (c=='s') {
|
||||||
sel.x[isel]=x;
|
if (sel.n < NMAX) {
|
||||||
sel.y[isel]=y;
|
sel.x[isel]=x;
|
||||||
isel++;
|
sel.y[isel]=y;
|
||||||
sel.n=isel;
|
isel++;
|
||||||
redraw=1;
|
sel.n=isel;
|
||||||
|
redraw=1;
|
||||||
|
} else {
|
||||||
|
printf("Maximum number of %i selection point reached.\n", NMAX);
|
||||||
|
}
|
||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -457,9 +461,11 @@ int main(int argc,char *argv[])
|
||||||
|
|
||||||
// Undo
|
// Undo
|
||||||
if (c=='u') {
|
if (c=='u') {
|
||||||
isel--;
|
if (sel.n > 0) {
|
||||||
sel.n=isel;
|
isel--;
|
||||||
redraw=1;
|
sel.n=isel;
|
||||||
|
redraw=1;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
// Increase
|
// Increase
|
||||||
|
|
Loading…
Reference in New Issue