From 5200e97d90e2adbeebdf06bd756f66df4e8f1b01 Mon Sep 17 00:00:00 2001 From: SoniEx2 Date: Thu, 14 Jul 2022 00:30:46 -0300 Subject: Add check for empty key --- src/main/java/ganarchy/friendcode/sam/I2PSamCommand.java | 4 ++++ 1 file changed, 4 insertions(+) (limited to 'src/main') diff --git a/src/main/java/ganarchy/friendcode/sam/I2PSamCommand.java b/src/main/java/ganarchy/friendcode/sam/I2PSamCommand.java index bed5bb8..b1cece8 100644 --- a/src/main/java/ganarchy/friendcode/sam/I2PSamCommand.java +++ b/src/main/java/ganarchy/friendcode/sam/I2PSamCommand.java @@ -45,6 +45,10 @@ record I2PSamCommand(String name, String opcode, Map parameters) throw new IllegalArgumentException("name must not be empty"); } + if (this.parameters.containsKey("")) { + throw new IllegalArgumentException("parameter key must not be empty"); + } + // check for PING/PONG if (this.name.equals("PING") || this.name.equals("PONG")) { // reject parameters -- cgit 1.4.1