X-Git-Url: https://git.nmode.ca/signal-cli/blobdiff_plain/106af6a801ad12045c3c98f235d5c9176784748f..4f8da7819e080382ffea7754e4fa5f29177d102f:/src/main/java/org/asamk/signal/commands/TrustCommand.java diff --git a/src/main/java/org/asamk/signal/commands/TrustCommand.java b/src/main/java/org/asamk/signal/commands/TrustCommand.java index 7d1dd632..9b9735d3 100644 --- a/src/main/java/org/asamk/signal/commands/TrustCommand.java +++ b/src/main/java/org/asamk/signal/commands/TrustCommand.java @@ -38,15 +38,15 @@ public class TrustCommand implements JsonRpcLocalCommand { var recipentString = ns.getString("recipient"); var recipient = CommandUtil.getSingleRecipientIdentifier(recipentString, m.getSelfNumber()); if (Boolean.TRUE.equals(ns.getBoolean("trust-all-known-keys"))) { - boolean res; try { - res = m.trustIdentityAllKeys(recipient); + final var res = m.trustIdentityAllKeys(recipient); + if (!res) { + throw new UserErrorException( + "Failed to set the trust for this number, make sure the number is correct."); + } } catch (UnregisteredRecipientException e) { throw new UserErrorException("The user " + e.getSender().getIdentifier() + " is not registered."); } - if (!res) { - throw new UserErrorException("Failed to set the trust for this number, make sure the number is correct."); - } } else { var safetyNumber = ns.getString("verified-safety-number"); if (safetyNumber == null) {