Fix console error when int parsing fails in clear message
This commit is contained in:
parent
2d1f6699ba
commit
c9528848bc
@ -43,7 +43,15 @@ public class ClearCommand implements MessageCommand
|
|||||||
// get the amount from the command args.
|
// get the amount from the command args.
|
||||||
Integer toDeleteAmount;
|
Integer toDeleteAmount;
|
||||||
if (args.length == 0) toDeleteAmount = 1;
|
if (args.length == 0) toDeleteAmount = 1;
|
||||||
else toDeleteAmount = Integer.parseInt(args[0]);
|
else
|
||||||
|
{
|
||||||
|
try {
|
||||||
|
toDeleteAmount = Integer.parseInt(args[0]);
|
||||||
|
} catch (NumberFormatException e)
|
||||||
|
{
|
||||||
|
toDeleteAmount = 1;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
error = ClearChat.checkDeleteAmount(toDeleteAmount);
|
error = ClearChat.checkDeleteAmount(toDeleteAmount);
|
||||||
if (error != null) {
|
if (error != null) {
|
||||||
|
Loading…
Reference in New Issue
Block a user