Marino Faggiana 7 жил өмнө
parent
commit
82ad604c84

+ 2 - 1
iOSClient/Database/NCManageDatabase.swift

@@ -1149,6 +1149,7 @@ class NCManageDatabase: NSObject {
             return nil
         }
         
+        let directoryID = metadata.directoryID
         let realm = try! Realm()
         
         do {
@@ -1159,7 +1160,7 @@ class NCManageDatabase: NSObject {
             print("Could not write to database: ", error)
         }
         
-        self.setDateReadDirectory(directoryID: metadata.directoryID)
+        self.setDateReadDirectory(directoryID: directoryID)
         
         return tableMetadata.init(value: metadata)
     }

+ 4 - 2
iOSClient/Utility/CCUtility.m

@@ -851,12 +851,14 @@
         NSDateFormatter *formatter = [[NSDateFormatter alloc] init];
         [formatter setDateFormat:@"yyyy"];
         NSString *yearString = [formatter stringFromDate:assetDate];
-        [datesSubFolder addObject:yearString];
+        if (yearString)
+            [datesSubFolder addObject:yearString];
         
         [formatter setDateFormat:@"MM"];
         NSString *monthString = [formatter stringFromDate:assetDate];
         monthString = [NSString stringWithFormat:@"%@/%@", yearString, monthString];
-        [datesSubFolder addObject:monthString];
+        if (monthString)
+            [datesSubFolder addObject:monthString];
     }
     
     return (NSArray *)datesSubFolder;