From e0a55073e7cfd6d0a695cae01f50b3dd7dc4c0de Mon Sep 17 00:00:00 2001 From: Shivang Date: Thu, 9 Jun 2022 18:40:19 +0530 Subject: [PATCH] throw error when data is nil in DocumentReference.getDocument --- Sources/Firestore/DocumentReference+Combine.swift | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/Sources/Firestore/DocumentReference+Combine.swift b/Sources/Firestore/DocumentReference+Combine.swift index dcd9e741..0d1b532c 100644 --- a/Sources/Firestore/DocumentReference+Combine.swift +++ b/Sources/Firestore/DocumentReference+Combine.swift @@ -134,7 +134,7 @@ extension DocumentReference { self?.getDocument(source: source, completion: { (snapshot, error) in if let error = error { promise(.failure(error)) - } else if let snapshot = snapshot { + } else if let snapshot = snapshot, snapshot.data() != nil { promise(.success(snapshot)) } else { promise(.failure(FirestoreError.nilResultError))