From be4b683a4199cfa97246738a81a1bb19a1a2d5fd Mon Sep 17 00:00:00 2001 From: AsamK Date: Mon, 8 Mar 2021 20:33:52 +0100 Subject: [PATCH] Allow MultiLocalCommands to be called when no local users exist --- src/main/java/org/asamk/signal/App.java | 7 +++---- 1 file changed, 3 insertions(+), 4 deletions(-) diff --git a/src/main/java/org/asamk/signal/App.java b/src/main/java/org/asamk/signal/App.java index 75ac5280..d4da356c 100644 --- a/src/main/java/org/asamk/signal/App.java +++ b/src/main/java/org/asamk/signal/App.java @@ -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"); }