Add amount field validation (#15)

This commit is contained in:
Caedis authored and GitHub committed 2024-08-07 13:16:06 +03:00
1 parent da39c8e14a
commit affe3f997f
1 file changed
+5 -1
@@ -271,7 +271,11 @@ public class GuiCraft extends Gui {
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) {