Skip to content

Commit

Permalink
rename numSides to prevent confusion with global variable
Browse files Browse the repository at this point in the history
  • Loading branch information
creme332 committed Aug 7, 2024
1 parent 3583905 commit 43d2339
Showing 1 changed file with 3 additions and 3 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -104,11 +104,11 @@ private int inputVertices() {

if (result == JOptionPane.OK_OPTION) {
try {
int numSides = Integer.parseInt(numSidesField.getText());
if (numSides < 3) {
int input = Integer.parseInt(numSidesField.getText());
if (input < 3) {
throw new NumberFormatException("Number of sides must be at least 3.");
}
return numSides;
return input;
} catch (NumberFormatException e) {
JOptionPane.showMessageDialog(canvas,
"Invalid input. Please enter an integer greater than or equal to 3 for the number of vertices.",
Expand Down

0 comments on commit 43d2339

Please sign in to comment.