]> nmode's Git Repositories - signal-cli/commitdiff
Allow MultiLocalCommands to be called when no local users exist
authorAsamK <asamk@gmx.de>
Mon, 8 Mar 2021 19:33:52 +0000 (20:33 +0100)
committerAsamK <asamk@gmx.de>
Mon, 8 Mar 2021 20:21:51 +0000 (21:21 +0100)
src/main/java/org/asamk/signal/App.java

index 75ac5280e05f873a36307796e525e7b92f2e1fa9..d4da356c15ca6e57517d159664c36c13c41b1650 100644 (file)
@@ -133,16 +133,15 @@ public class App {
 
         if (username == null) {
             var usernames = Manager.getAllLocalUsernames(dataPath);
-            if (usernames.size() == 0) {
-                throw new UserErrorException("No local users found, you first need to register or link an account");
-            }
 
             if (command instanceof MultiLocalCommand) {
                 handleMultiLocalCommand((MultiLocalCommand) command, dataPath, serviceEnvironment, usernames);
                 return;
             }
 
-            if (usernames.size() > 1) {
+            if (usernames.size() == 0) {
+                throw new UserErrorException("No local users found, you first need to register or link an account");
+            } else if (usernames.size() > 1) {
                 throw new UserErrorException(
                         "Multiple users found, you need to specify a username (phone number) with -u");
             }