From ea11f3b1fd2c1e2ab6ef0eff87416f00f6996e29 Mon Sep 17 00:00:00 2001 From: AsamK Date: Wed, 12 May 2021 20:12:05 +0200 Subject: [PATCH] Fix NPE when legacy profile has no capabilities Fixes #616 --- .../signal/manager/storage/SignalAccount.java | 18 ++++++++++-------- 1 file changed, 10 insertions(+), 8 deletions(-) diff --git a/lib/src/main/java/org/asamk/signal/manager/storage/SignalAccount.java b/lib/src/main/java/org/asamk/signal/manager/storage/SignalAccount.java index f5ac995c..386d2287 100644 --- a/lib/src/main/java/org/asamk/signal/manager/storage/SignalAccount.java +++ b/lib/src/main/java/org/asamk/signal/manager/storage/SignalAccount.java @@ -552,14 +552,16 @@ public class SignalAccount implements Closeable { final var profile = profileEntry.getProfile(); if (profile != null) { final var capabilities = new HashSet(); - 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(),