]> nmode's Git Repositories - signal-cli/commitdiff
Fix NPE when legacy profile has no capabilities
authorAsamK <asamk@gmx.de>
Wed, 12 May 2021 18:12:05 +0000 (20:12 +0200)
committerAsamK <asamk@gmx.de>
Wed, 12 May 2021 18:12:05 +0000 (20:12 +0200)
Fixes #616

lib/src/main/java/org/asamk/signal/manager/storage/SignalAccount.java

index f5ac995c601dae5cb1471e4d963dd3799777a9c9..386d2287df14513f4b325f552b9bae8d19fff878 100644 (file)
@@ -552,14 +552,16 @@ public class SignalAccount implements Closeable {
                 final var profile = profileEntry.getProfile();
                 if (profile != null) {
                     final var capabilities = new HashSet<Profile.Capability>();
                 final var profile = profileEntry.getProfile();
                 if (profile != null) {
                     final var capabilities = new HashSet<Profile.Capability>();
-                    if (profile.getCapabilities().gv1Migration) {
-                        capabilities.add(Profile.Capability.gv1Migration);
-                    }
-                    if (profile.getCapabilities().gv2) {
-                        capabilities.add(Profile.Capability.gv2);
-                    }
-                    if (profile.getCapabilities().storage) {
-                        capabilities.add(Profile.Capability.storage);
+                    if (profile.getCapabilities() != null) {
+                        if (profile.getCapabilities().gv1Migration) {
+                            capabilities.add(Profile.Capability.gv1Migration);
+                        }
+                        if (profile.getCapabilities().gv2) {
+                            capabilities.add(Profile.Capability.gv2);
+                        }
+                        if (profile.getCapabilities().storage) {
+                            capabilities.add(Profile.Capability.storage);
+                        }
                     }
                     final var newProfile = new Profile(profileEntry.getLastUpdateTimestamp(),
                             profile.getGivenName(),
                     }
                     final var newProfile = new Profile(profileEntry.getLastUpdateTimestamp(),
                             profile.getGivenName(),