Skip to content

Commit bc3fb27

Browse files
author
Jean-François Morin
committed
Make variables for CSV export null-proof
1 parent 4003193 commit bc3fb27

File tree

1 file changed

+3
-3
lines changed

1 file changed

+3
-3
lines changed

src/app/admin/admin-reports/filtered-items/filtered-items-export-csv/filtered-items-export-csv.component.ts

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -84,14 +84,14 @@ export class FilteredItemsExportCsvComponent implements OnInit {
8484
*/
8585
export() {
8686
const parameters = [];
87-
const colls = this.reportParams.value.collections;
87+
const colls = this.reportParams.value.collections || [];
8888
for (let i = 0; i < colls.length; i++) {
8989
if (colls[i]) {
9090
parameters.push({ name: '-c', value: colls[i] });
9191
}
9292
}
9393

94-
const preds = this.reportParams.value.queryPredicates;
94+
const preds = this.reportParams.value.queryPredicates || [];
9595
for (let i = 0; i < preds.length; i++) {
9696
const field = preds[i].field;
9797
const op = preds[i].operator;
@@ -105,7 +105,7 @@ export class FilteredItemsExportCsvComponent implements OnInit {
105105
}
106106
}
107107

108-
const filters = FiltersComponent.toQueryString(this.reportParams.value.filters);
108+
const filters = FiltersComponent.toQueryString(this.reportParams.value.filters) || [];
109109
if (filters.length > 0) {
110110
parameters.push({ name: '-f', value: filters });
111111
}

0 commit comments

Comments
 (0)