Merge pull request #628 from ente-io/null_handling
Fixes couple of bugs reported on sentry
This commit is contained in:
commit
0eb0c106d1
2 changed files with 5 additions and 2 deletions
|
@ -209,6 +209,7 @@ extension DeviceFiles on FilesDB {
|
|||
"cover_id": localID,
|
||||
"should_backup": shouldBackup ? _sqlBoolTrue : _sqlBoolFalse
|
||||
},
|
||||
conflictAlgorithm: ConflictAlgorithm.ignore,
|
||||
);
|
||||
}
|
||||
}
|
||||
|
|
|
@ -580,6 +580,8 @@ class RemoteSyncService {
|
|||
File existingFile;
|
||||
if (remoteDiff.generatedID != null) {
|
||||
// Case [1] Check and clear local cache when uploadedFile already exist
|
||||
// Note: Existing file can be null here if it's replaced by the time we
|
||||
// reach here
|
||||
existingFile = await _db.getFile(remoteDiff.generatedID);
|
||||
if (_shouldClearCache(remoteDiff, existingFile)) {
|
||||
needsGalleryReload = true;
|
||||
|
@ -692,10 +694,10 @@ class RemoteSyncService {
|
|||
}
|
||||
|
||||
bool _shouldClearCache(File remoteFile, File existingFile) {
|
||||
if (remoteFile.hash != null && existingFile.hash != null) {
|
||||
if (remoteFile.hash != null && existingFile?.hash != null) {
|
||||
return remoteFile.hash != existingFile.hash;
|
||||
}
|
||||
return remoteFile.updationTime != (existingFile.updationTime ?? 0);
|
||||
return remoteFile.updationTime != (existingFile?.updationTime ?? 0);
|
||||
}
|
||||
|
||||
bool _shouldReloadHomeGallery(File remoteFile, File existingFile) {
|
||||
|
|
Loading…
Add table
Reference in a new issue