Fix handling incoming contacts sync message

This commit is contained in:
AsamK 2021-08-30 21:07:24 +02:00
parent 626406a43c
commit 0d0978011d
2 changed files with 5 additions and 6 deletions

View file

@ -88,9 +88,9 @@ public class AttachmentHelper {
SignalServiceAttachment attachment, AttachmentHandler consumer
) throws IOException {
if (attachment.isStream()) {
try (var input = attachment.asStream().getInputStream()) {
var input = attachment.asStream().getInputStream();
// don't close input stream here, it might be reused later (e.g. with contact sync messages ...)
consumer.handle(input);
}
return;
}

View file

@ -215,7 +215,7 @@ public class SyncHelper {
sendHelper.sendSyncMessage(SignalServiceSyncMessage.forVerified(verifiedMessage));
}
public void handleSyncDeviceContacts(final InputStream input) {
public void handleSyncDeviceContacts(final InputStream input) throws IOException {
final var s = new DeviceContactsInputStream(input);
DeviceContact c;
while (true) {
@ -226,8 +226,7 @@ public class SyncHelper {
logger.warn("Sync contacts contained invalid contact, ignoring: {}", e.getMessage());
continue;
} else {
logger.warn("Failed to read sync contacts", e);
break;
throw e;
}
}
if (c == null) {