diff --git a/lib/modules/firestore/DocumentSnapshot.js b/lib/modules/firestore/DocumentSnapshot.js index d7317e79..aae8dc7e 100644 --- a/lib/modules/firestore/DocumentSnapshot.js +++ b/lib/modules/firestore/DocumentSnapshot.js @@ -63,6 +63,7 @@ export default class DocumentSnapshot { if (fieldPath instanceof FieldPath) { return extractFieldPathData(this._data, fieldPath._segments); } - return this._data ? deepGet(this._data, fieldPath, '.') : undefined; + + return deepGet(this._data, fieldPath, '.'); } } diff --git a/lib/utils/index.js b/lib/utils/index.js index ca9f1973..dc539b14 100644 --- a/lib/utils/index.js +++ b/lib/utils/index.js @@ -25,6 +25,7 @@ export function deepGet( path: string, joiner?: string = '/' ): any { + if (!isObject(object)) return undefined; const keys = path.split(joiner); let i = 0;