Skip to content

Commit 3c32bb8

Browse files
committed
Mutations can return nil
For example, a patch mutation applied to a nil baseDoc will return nil.
1 parent 5323a45 commit 3c32bb8

File tree

1 file changed

+1
-1
lines changed

1 file changed

+1
-1
lines changed

Firestore/Source/Local/FSTLocalDocumentsView.mm

+1-1
Original file line numberDiff line numberDiff line change
@@ -132,7 +132,7 @@ - (FSTDocumentDictionary *)documentsMatchingCollectionQuery:(FSTQuery *)query {
132132
FSTMaybeDocument *mutatedDoc =
133133
[mutation applyTo:baseDoc baseDocument:baseDoc localWriteTime:batch.localWriteTime];
134134

135-
if ([mutatedDoc isKindOfClass:[FSTDeletedDocument class]]) {
135+
if (!mutatedDoc || [mutatedDoc isKindOfClass:[FSTDeletedDocument class]]) {
136136
results = [results dictionaryByRemovingObjectForKey:key];
137137
} else if ([mutatedDoc isKindOfClass:[FSTDocument class]]) {
138138
results = [results dictionaryBySettingObject:(FSTDocument *)mutatedDoc forKey:key];

0 commit comments

Comments
 (0)