[RFPlot] Prevent under/overflow of selection buffer

pull/21/head
Martin Herren (HB9FXX) 2021-06-25 11:07:20 +02:00
parent 0177a2d38f
commit cbfd40931b
No known key found for this signature in database
GPG Key ID: 0BD2A4A2A9106D59
1 changed files with 14 additions and 8 deletions

View File

@ -384,11 +384,15 @@ int main(int argc,char *argv[])
// Select start
if (c=='s') {
sel.x[isel]=x;
sel.y[isel]=y;
isel++;
sel.n=isel;
redraw=1;
if (sel.n < NMAX) {
sel.x[isel]=x;
sel.y[isel]=y;
isel++;
sel.n=isel;
redraw=1;
} else {
printf("Maximum number of %i selection point reached.\n", NMAX);
}
continue;
}
@ -457,9 +461,11 @@ int main(int argc,char *argv[])
// Undo
if (c=='u') {
isel--;
sel.n=isel;
redraw=1;
if (sel.n > 0) {
isel--;
sel.n=isel;
redraw=1;
}
}
// Increase