Skip to content

Commit

Permalink
Add amount field validation (#15)
Browse files Browse the repository at this point in the history
  • Loading branch information
Caedis authored Aug 7, 2024
1 parent da39c8e commit affe3f9
Showing 1 changed file with 5 additions and 1 deletion.
Original file line number Diff line number Diff line change
Expand Up @@ -271,7 +271,11 @@ private void refreshCrafts() {

private long getCurrentAmount() {
String s = amount.getText();
return s.isEmpty() ? 1 : Long.parseLong(amount.getText());
try {
return s.isEmpty() ? 1 : Long.parseLong(amount.getText());
} catch (NumberFormatException ignored) {
return 1;
}
}

private void addLabel(ILabel l) {
Expand Down

0 comments on commit affe3f9

Please sign in to comment.