瀏覽代碼

fix(mobile): fix null check operator on null value (#2204)

Alex 2 年之前
父節點
當前提交
9fc70fc24e
共有 1 個文件被更改,包括 2 次插入2 次删除
  1. 2 2
      mobile/lib/shared/services/sync.service.dart

+ 2 - 2
mobile/lib/shared/services/sync.service.dart

@@ -447,7 +447,7 @@ class SyncService {
     deleteCandidates.addAll(toDelete);
     existing.addAll(result.first);
     album.name = ape.name;
-    album.modifiedAt = ape.lastModified!;
+    album.modifiedAt = ape.lastModified ?? DateTime.now();
     if (album.thumbnail.value != null &&
         toDelete.contains(album.thumbnail.value)) {
       album.thumbnail.value = null;
@@ -491,7 +491,7 @@ class SyncService {
     if (totalOnDevice != album.assets.length + newAssets.length) {
       return false;
     }
-    album.modifiedAt = ape.lastModified!.toUtc();
+    album.modifiedAt = ape.lastModified?.toUtc() ?? DateTime.now().toUtc();
     final result = await _linkWithExistingFromDb(newAssets);
     try {
       await _db.writeTxn(() async {