Fix NPE in account record proto parsing.

This commit is contained in:
Cody Henthorne 2023-10-10 21:04:16 -04:00
parent 046ce30e08
commit 5285dd1665

View file

@ -49,10 +49,15 @@ public final class SignalAccountRecord implements SignalRecord {
this.profileKey = OptionalUtil.absentIfEmpty(proto.profileKey);
this.avatarUrlPath = OptionalUtil.absentIfEmpty(proto.avatarUrlPath);
this.pinnedConversations = new ArrayList<>(proto.pinnedConversations.size());
this.payments = new Payments(proto.payments.enabled, OptionalUtil.absentIfEmpty(proto.payments.entropy));
this.defaultReactions = new ArrayList<>(proto.preferredReactionEmoji);
this.subscriber = new Subscriber(proto.subscriberCurrencyCode, proto.subscriberId.toByteArray());
if (proto.payments != null) {
this.payments = new Payments(proto.payments.enabled, OptionalUtil.absentIfEmpty(proto.payments.entropy));
} else {
this.payments = new Payments(false, Optional.empty());
}
for (AccountRecord.PinnedConversation conversation : proto.pinnedConversations) {
pinnedConversations.add(PinnedConversation.fromRemote(conversation));
}