Fix NPE in RecipientDatabase.

fork-5.53.8
Greyson Parrelli 2021-01-17 00:17:26 -05:00
rodzic 4f4aea22ce
commit a517fc4e15
1 zmienionych plików z 6 dodań i 1 usunięć

Wyświetl plik

@ -1529,7 +1529,12 @@ public class RecipientDatabase extends Database {
try (Cursor cursor = db.query(TABLE_NAME, new String[] {LAST_SESSION_RESET}, ID_WHERE, SqlUtil.buildArgs(id), null, null, null)) {
if (cursor.moveToFirst()) {
try {
return DeviceLastResetTime.parseFrom(CursorUtil.requireBlob(cursor, LAST_SESSION_RESET));
byte[] serialized = CursorUtil.requireBlob(cursor, LAST_SESSION_RESET);
if (serialized != null) {
return DeviceLastResetTime.parseFrom(serialized);
} else {
return DeviceLastResetTime.newBuilder().build();
}
} catch (InvalidProtocolBufferException | SQLException e) {
Log.w(TAG, e);
return DeviceLastResetTime.newBuilder().build();