]> nmode's Git Repositories - signal-cli/commitdiff
Add missing handling for SecureValueRecovery.RestoreResponse.Missing response
authorAsamK <asamk@gmx.de>
Wed, 9 Aug 2023 17:38:29 +0000 (19:38 +0200)
committerAsamK <asamk@gmx.de>
Wed, 9 Aug 2023 17:38:29 +0000 (19:38 +0200)
lib/src/main/java/org/asamk/signal/manager/helper/PinHelper.java

index 2c56092eddb9640ae0ba50c304fcc934e8cc50fe..dcd89f206af626f49959cbac88f12ad7f8079dfd 100644 (file)
@@ -108,7 +108,10 @@ public class PinHelper {
     ) throws IOException, IncorrectPinException {
         var svr1Credentials = e.getSvr1Credentials();
         if (svr1Credentials != null) {
     ) throws IOException, IncorrectPinException {
         var svr1Credentials = e.getSvr1Credentials();
         if (svr1Credentials != null) {
-            return getRegistrationLockData(secureValueRecoveryV1, svr1Credentials, pin);
+            final var registrationLockData = getRegistrationLockData(secureValueRecoveryV1, svr1Credentials, pin);
+            if (registrationLockData != null) {
+                return registrationLockData;
+            }
         }
 
         var svr2Credentials = e.getSvr2Credentials();
         }
 
         var svr2Credentials = e.getSvr2Credentials();
@@ -132,8 +135,11 @@ public class PinHelper {
             throw new IOException(error.getException());
         } else if (restoreResponse instanceof SecureValueRecovery.RestoreResponse.NetworkError error) {
             throw error.getException();
             throw new IOException(error.getException());
         } else if (restoreResponse instanceof SecureValueRecovery.RestoreResponse.NetworkError error) {
             throw error.getException();
+        } else if (restoreResponse instanceof SecureValueRecovery.RestoreResponse.Missing) {
+            logger.debug("No SVR data stored for the given credentials.");
+            return null;
         } else {
         } else {
-            throw new AssertionError("Unexpected response");
+            throw new AssertionError("Unexpected response: " + restoreResponse.getClass().getSimpleName());
         }
     }
 }
         }
     }
 }