No fields within a distribution formula are required, so confirm a set
of values exists before calling Object.keys() on an undefined value.
Signed-off-by: Bill Erickson <berickxx@gmail.com>
Signed-off-by: Galen Charlton <gmc@equinoxOLI.org>
Signed-off-by: Jane Sandberg <js7389@princeton.edu>
// are not required to go fetch them en masse / en duplicato.
fetchFormulaValues(): Promise<any> {
- const funds = Object.keys(this.formulaValues.fund);
- const mods = Object.keys(this.formulaValues.circ_modifier);
- const locs = Object.keys(this.formulaValues.location);
+ const funds = this.formulaValues.fund ?
+ Object.keys(this.formulaValues.fund) : [];
+
+ const mods = this.formulaValues.circ_modifier ?
+ Object.keys(this.formulaValues.circ_modifier) : [];
+
+ const locs = this.formulaValues.location ?
+ Object.keys(this.formulaValues.location) : [];
let promise = Promise.resolve();