From 3a51309ac245dd2970cf9f789048c8a01d2dbcf6 Mon Sep 17 00:00:00 2001 From: Nereus Ng Wei Bin Date: Tue, 19 Sep 2023 00:59:02 +0800 Subject: [PATCH] Fix exception not thrown for invalid num of args --- src/main/java/corgi/parsers/CommandValidator.java | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/src/main/java/corgi/parsers/CommandValidator.java b/src/main/java/corgi/parsers/CommandValidator.java index 501f1c206e..c8051a379b 100644 --- a/src/main/java/corgi/parsers/CommandValidator.java +++ b/src/main/java/corgi/parsers/CommandValidator.java @@ -32,8 +32,9 @@ public void validateArguments(String command, Set arguments) continue; } + isValid = false; + if (numOfArg == 0) { - isValid = false; errorMsg.add("Missing argument " + "\"" + argument + "\" !"); } else { errorMsg.add("Invalid number of argument " + "\"" + argument + "\" !");