From 92fbeb1039f5769f10ad37f3a5d2a60bb1d2f180 Mon Sep 17 00:00:00 2001 From: Tom Winter Date: Thu, 8 Feb 2024 12:11:11 +0100 Subject: [PATCH] fix: null pointer --- .../repository/report-calculation-repository.service.ts | 4 ++-- src/report/storage/report-storage.service.ts | 4 ++++ 2 files changed, 6 insertions(+), 2 deletions(-) diff --git a/src/report/repository/report-calculation-repository.service.ts b/src/report/repository/report-calculation-repository.service.ts index f917533..78b6b68 100644 --- a/src/report/repository/report-calculation-repository.service.ts +++ b/src/report/repository/report-calculation-repository.service.ts @@ -76,7 +76,7 @@ export class ReportCalculationRepository { params: { include_docs: true, start_key: '"ReportCalculation"', - end_key: '"ReportCalculation' + 'ufff0"', // ufff0 -> high value unicode character + end_key: '"ReportCalculation' + '\ufff0"', // ufff0 -> high value unicode character }, headers: { Authorization: this.authHeaderValue, @@ -172,7 +172,7 @@ export class ReportCalculationRepository { params: { include_docs: true, start_key: '"' + calculationId + '"', - end_key: '"ReportCalculation' + 'ufff0"', // ufff0 -> high value unicode character + end_key: '"ReportCalculation' + '\ufff0"', // ufff0 -> high value unicode character }, headers: { Authorization: this.authHeaderValue, diff --git a/src/report/storage/report-storage.service.ts b/src/report/storage/report-storage.service.ts index 7425a2c..518f41a 100644 --- a/src/report/storage/report-storage.service.ts +++ b/src/report/storage/report-storage.service.ts @@ -24,6 +24,10 @@ export class DefaultReportStorage implements ReportStorage { fetchAllReports(authToken: string): Observable { return this.reportRepository.fetchReports(authToken).pipe( map((response) => { + if (!response || !response.rows) { + return []; + } + return response.rows.map((reportEntity) => new Report(reportEntity.id, reportEntity.doc.title).setSchema( reportEntity.doc.aggregationDefinitions,