Skip to content

Commit

Permalink
Early return when no message args are provided
Browse files Browse the repository at this point in the history
  • Loading branch information
CominAtYou committed Apr 27, 2024
1 parent a9e42aa commit 87ec85d
Showing 1 changed file with 2 additions and 1 deletion.
3 changes: 2 additions & 1 deletion src/main/java/com/cominatyou/TextCommandHandler.java
Original file line number Diff line number Diff line change
Expand Up @@ -43,8 +43,9 @@ public class TextCommandHandler {

public static void getCommand(MessageCreateEvent event) {
final String[] messageContentArray = event.getMessageContent().substring(Config.PREFIX.length()).split(" +");
final ArrayList<String> messageArgs = new ArrayList<>(Arrays.asList(messageContentArray));
if (messageContentArray.length == 0) return;

final ArrayList<String> messageArgs = new ArrayList<>(Arrays.asList(messageContentArray));
final String command = messageArgs.remove(0).toLowerCase();

if (sharedCommands.containsKey(command)) {
Expand Down

0 comments on commit 87ec85d

Please sign in to comment.