Skip invalid contact records

This commit is contained in:
AsamK 2021-06-12 08:49:37 +02:00
parent 0001a9b300
commit 795b73df87

View file

@ -2320,7 +2320,17 @@ public class Manager implements Closeable {
.asPointer(), tmpFile)) {
var s = new DeviceContactsInputStream(attachmentAsStream);
DeviceContact c;
while ((c = s.read()) != null) {
while (true) {
try {
c = s.read();
} catch (IOException e) {
logger.warn("Sync contacts contained invalid contact, ignoring: {}",
e.getMessage());
continue;
}
if (c == null) {
break;
}
if (c.getAddress().matches(account.getSelfAddress()) && c.getProfileKey().isPresent()) {
account.setProfileKey(c.getProfileKey().get());
}