Skip to content

Commit

Permalink
fix(firestore, ios): fix an issue when removing a value that didn't e…
Browse files Browse the repository at this point in the history
…xist in ServerTimestampBehavior map (#10370)
  • Loading branch information
Lyokone committed Feb 2, 2023
1 parent 8224acb commit 6da8703
Showing 1 changed file with 7 additions and 3 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -191,11 +191,15 @@ - (NSDictionary *)FIRQuerySnapshot:(FIRQuerySnapshot *)querySnapshot {
NSMutableArray *paths = [NSMutableArray array];
NSMutableArray *documents = [NSMutableArray array];
NSMutableArray *metadatas = [NSMutableArray array];
NSString *timestampBehaviorString =
FLTFirebaseFirestorePlugin.serverTimestampMap[@([querySnapshot hash])];

FIRServerTimestampBehavior serverTimestampBehavior =
[self toServerTimestampBehavior:FLTFirebaseFirestorePlugin
.serverTimestampMap[@([querySnapshot hash])]];
[self toServerTimestampBehavior:timestampBehaviorString];

[FLTFirebaseFirestorePlugin.serverTimestampMap removeObjectForKey:@([querySnapshot hash])];
if (timestampBehaviorString != nil) {
[FLTFirebaseFirestorePlugin.serverTimestampMap removeObjectForKey:@([querySnapshot hash])];
}

for (FIRDocumentSnapshot *document in querySnapshot.documents) {
[paths addObject:document.reference.path];
Expand Down

0 comments on commit 6da8703

Please sign in to comment.