Преглед на файлове

handle cases where title is null for getDisplayName

ashilkn преди 2 години
родител
ревизия
3de66f782e
променени са 1 файла, в които са добавени 5 реда и са изтрити 1 реда
  1. 5 1
      lib/models/file.dart

+ 5 - 1
lib/models/file.dart

@@ -1,3 +1,4 @@
+import 'package:logging/logging.dart';
 import 'package:path/path.dart';
 import 'package:photo_manager/photo_manager.dart';
 import 'package:photos/core/configuration.dart';
@@ -60,6 +61,8 @@ class File extends EnteFile {
   // in V2: LivePhoto hash is stored as imgHash:vidHash
   static const kCurrentMetadataVersion = 2;
 
+  static final _logger = Logger('File');
+
   File();
 
   static Future<File> fromAsset(String pathName, AssetEntity asset) async {
@@ -225,7 +228,8 @@ class File extends EnteFile {
     if (pubMagicMetadata != null && pubMagicMetadata!.editedName != null) {
       return pubMagicMetadata!.editedName!;
     }
-    return title!;
+    if (title == null) _logger.severe('File title is null');
+    return title ?? '';
   }
 
   // returns true if the file isn't available in the user's gallery