Fix null pointer exception sentry#5606
This commit is contained in:
parent
497e3a25fb
commit
afe10c0adc
|
@ -580,6 +580,8 @@ class RemoteSyncService {
|
||||||
File existingFile;
|
File existingFile;
|
||||||
if (remoteDiff.generatedID != null) {
|
if (remoteDiff.generatedID != null) {
|
||||||
// Case [1] Check and clear local cache when uploadedFile already exist
|
// 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);
|
existingFile = await _db.getFile(remoteDiff.generatedID);
|
||||||
if (_shouldClearCache(remoteDiff, existingFile)) {
|
if (_shouldClearCache(remoteDiff, existingFile)) {
|
||||||
needsGalleryReload = true;
|
needsGalleryReload = true;
|
||||||
|
@ -692,10 +694,10 @@ class RemoteSyncService {
|
||||||
}
|
}
|
||||||
|
|
||||||
bool _shouldClearCache(File remoteFile, File existingFile) {
|
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.hash != existingFile.hash;
|
||||||
}
|
}
|
||||||
return remoteFile.updationTime != (existingFile.updationTime ?? 0);
|
return remoteFile.updationTime != (existingFile?.updationTime ?? 0);
|
||||||
}
|
}
|
||||||
|
|
||||||
bool _shouldReloadHomeGallery(File remoteFile, File existingFile) {
|
bool _shouldReloadHomeGallery(File remoteFile, File existingFile) {
|
||||||
|
|
Loading…
Reference in a new issue