Skip to content

Commit

Permalink
Fix issue 1069
Browse files Browse the repository at this point in the history
  • Loading branch information
samtstern committed Dec 21, 2018
1 parent f960a7f commit 9aa18ef
Showing 1 changed file with 10 additions and 0 deletions.
10 changes: 10 additions & 0 deletions src/firestore/indexes.ts
Original file line number Diff line number Diff line change
Expand Up @@ -103,6 +103,10 @@ export class FirestoreIndexes {
});

const indexes = res.body.indexes;
if (!indexes) {
return [];
}

return indexes.map(
(index: any): API.Index => {
// Ignore any fields that point at the document ID, as those are implied
Expand Down Expand Up @@ -136,6 +140,12 @@ export class FirestoreIndexes {

const fields = res.body.fields as API.Field[];

// This should never be the case, since the API always returns the __default__
// configuration, but this is a defensive check.
if (!fields) {
return [];
}

// Ignore the default config, only list other fields.
return fields.filter((field) => {
return field.name.indexOf("__default__") < 0;
Expand Down

0 comments on commit 9aa18ef

Please sign in to comment.