Skip to content

Commit

Permalink
Fix crash when opening debuglogs during registration.
Browse files Browse the repository at this point in the history
  • Loading branch information
greyson-signal committed Aug 7, 2020
1 parent b369b73 commit 99c0c2f
Showing 1 changed file with 14 additions and 8 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,7 @@

import org.thoughtcrime.securesms.AppCapabilities;
import org.thoughtcrime.securesms.recipients.Recipient;
import org.thoughtcrime.securesms.util.TextSecurePreferences;
import org.whispersystems.signalservice.api.profiles.SignalServiceProfile;

public final class LogSectionCapabilities implements LogSection {
Expand All @@ -17,16 +18,21 @@ public final class LogSectionCapabilities implements LogSection {

@Override
public @NonNull CharSequence getContent(@NonNull Context context) {
Recipient self = Recipient.self();
if (!self.isRegistered()) {
if (!TextSecurePreferences.isPushRegistered(context)) {
return "Unregistered";
} else {
SignalServiceProfile.Capabilities capabilities = AppCapabilities.getCapabilities(false);
}

return new StringBuilder().append("Local device UUID : ").append(capabilities.isUuid()).append("\n")
.append("Global UUID : ").append(self.getUuidCapability()).append("\n")
.append("Local device GV2 : ").append(capabilities.isGv2()).append("\n")
.append("Global GV2 : ").append(self.getGroupsV2Capability()).append("\n");
if (TextSecurePreferences.getLocalNumber(context) == null || TextSecurePreferences.getLocalUuid(context) == null) {
return "Self not yet available!";
}

Recipient self = Recipient.self();

SignalServiceProfile.Capabilities capabilities = AppCapabilities.getCapabilities(false);

return new StringBuilder().append("Local device UUID : ").append(capabilities.isUuid()).append("\n")
.append("Global UUID : ").append(self.getUuidCapability()).append("\n")
.append("Local device GV2 : ").append(capabilities.isGv2()).append("\n")
.append("Global GV2 : ").append(self.getGroupsV2Capability()).append("\n");
}
}

0 comments on commit 99c0c2f

Please sign in to comment.