[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 // 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