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 (#10391)
  • Loading branch information
Lyokone committed Feb 7, 2023
1 parent db67962 commit 2929ac9
Showing 1 changed file with 7 additions and 3 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -149,11 +149,15 @@ - (FIRServerTimestampBehavior)toServerTimestampBehavior:(NSString *)serverTimest
}

- (NSDictionary *)FIRDocumentSnapshot:(FIRDocumentSnapshot *)documentSnapshot {
NSString *timestampBehaviorString =
FLTFirebaseFirestorePlugin.serverTimestampMap[@([documentSnapshot hash])];

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

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

return @{
@"path" : documentSnapshot.reference.path,
Expand Down

0 comments on commit 2929ac9

Please sign in to comment.