fix NPE in PushGroupUpdateJob

Fixes #5919
Closes #5921
// FREEBIE
This commit is contained in:
Benedikt Constantin Radtke 2016-12-03 22:38:22 +01:00 committed by Moxie Marlinspike
parent 5d341e175d
commit d9ff5b00b7

View File

@ -57,17 +57,21 @@ public class PushGroupUpdateJob extends ContextJob implements InjectableType {
SignalServiceMessageSender messageSender = messageSenderFactory.create();
GroupDatabase groupDatabase = DatabaseFactory.getGroupDatabase(context);
GroupRecord record = groupDatabase.getGroup(groupId);
SignalServiceAttachment avatar = null;
if (record == null) {
Log.w(TAG, "No information for group record info request: " + new String(groupId));
return;
}
SignalServiceAttachment avatar = SignalServiceAttachmentStream.newStreamBuilder()
if (record.getAvatar() != null) {
avatar = SignalServiceAttachmentStream.newStreamBuilder()
.withContentType("image/jpeg")
.withStream(new ByteArrayInputStream(record.getAvatar()))
.withLength(record.getAvatar().length)
.build();
}
SignalServiceGroup groupContext = SignalServiceGroup.newBuilder(Type.UPDATE)
.withAvatar(avatar)