Fix check for username

The username in the JSON body is optional, only if it was specified it
must match the username from the URL.

Change-Id: I1eef312c8dbcf5b20fe7b556e6ca825d99686058
Signed-off-by: Edwin Kempin <edwin.kempin@sap.com>
diff --git a/src/main/java/com/googlesource/gerrit/plugins/serviceuser/CreateServiceUser.java b/src/main/java/com/googlesource/gerrit/plugins/serviceuser/CreateServiceUser.java
index 05f89e9..72af687 100644
--- a/src/main/java/com/googlesource/gerrit/plugins/serviceuser/CreateServiceUser.java
+++ b/src/main/java/com/googlesource/gerrit/plugins/serviceuser/CreateServiceUser.java
@@ -117,7 +117,7 @@
     if (input == null) {
       input = new Input();
     }
-    if (!username.equals(input.username)) {
+    if (input.username != null && !username.equals(input.username)) {
       throw new BadRequestException("username must match URL");
     }
     if (Strings.isNullOrEmpty(input.sshKey)) {