From 04eb452e043ea603a879dad0bb29a5f18f81eb61 Mon Sep 17 00:00:00 2001 From: Thomas Kaul <4159106+dtslvr@users.noreply.github.com> Date: Sat, 10 Jun 2023 16:16:27 +0200 Subject: [PATCH] Add missing guards (#2067) --- .../pages/portfolio/analysis/analysis-page.component.ts | 8 ++++---- .../portfolio-proportion-chart.component.ts | 2 +- 2 files changed, 5 insertions(+), 5 deletions(-) diff --git a/apps/client/src/app/pages/portfolio/analysis/analysis-page.component.ts b/apps/client/src/app/pages/portfolio/analysis/analysis-page.component.ts index 0e493ec9c..a9ab22454 100644 --- a/apps/client/src/app/pages/portfolio/analysis/analysis-page.component.ts +++ b/apps/client/src/app/pages/portfolio/analysis/analysis-page.component.ts @@ -251,18 +251,18 @@ export class AnalysisPageComponent implements OnDestroy, OnInit { this.streaks = streaks; this.unitCurrentStreak = this.mode === 'year' - ? this.streaks.currentStreak === 1 + ? this.streaks?.currentStreak === 1 ? translate('YEAR') : translate('YEARS') - : this.streaks.currentStreak === 1 + : this.streaks?.currentStreak === 1 ? translate('MONTH') : translate('MONTHS'); this.unitLongestStreak = this.mode === 'year' - ? this.streaks.longestStreak === 1 + ? this.streaks?.longestStreak === 1 ? translate('YEAR') : translate('YEARS') - : this.streaks.longestStreak === 1 + : this.streaks?.longestStreak === 1 ? translate('MONTH') : translate('MONTHS'); diff --git a/libs/ui/src/lib/portfolio-proportion-chart/portfolio-proportion-chart.component.ts b/libs/ui/src/lib/portfolio-proportion-chart/portfolio-proportion-chart.component.ts index 452cd8f35..ec0a63eea 100644 --- a/libs/ui/src/lib/portfolio-proportion-chart/portfolio-proportion-chart.component.ts +++ b/libs/ui/src/lib/portfolio-proportion-chart/portfolio-proportion-chart.component.ts @@ -100,7 +100,7 @@ export class PortfolioProportionChartComponent }; Object.keys(this.positions).forEach((symbol) => { - if (this.positions[symbol][this.keys[0]].toUpperCase()) { + if (this.positions[symbol][this.keys[0]]?.toUpperCase()) { if (chartData[this.positions[symbol][this.keys[0]].toUpperCase()]) { chartData[this.positions[symbol][this.keys[0]].toUpperCase()].value = chartData[