From 24edf641933e3278f74c91f921f40d6e012455ec Mon Sep 17 00:00:00 2001 From: Thomas <4159106+dtslvr@users.noreply.github.com> Date: Fri, 31 Dec 2021 21:06:21 +0100 Subject: [PATCH] Add guards --- apps/api/src/app/portfolio/portfolio.service.ts | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/apps/api/src/app/portfolio/portfolio.service.ts b/apps/api/src/app/portfolio/portfolio.service.ts index 9a44d2d8e..815900278 100644 --- a/apps/api/src/app/portfolio/portfolio.service.ts +++ b/apps/api/src/app/portfolio/portfolio.service.ts @@ -447,17 +447,17 @@ export class PortfolioService { // Convert investment, gross and net performance to currency of user const userCurrency = this.request.user.Settings.currency; const investment = this.exchangeRateDataService.toCurrency( - position.investment.toNumber(), + position.investment?.toNumber(), currency, userCurrency ); const grossPerformance = this.exchangeRateDataService.toCurrency( - position.grossPerformance.toNumber(), + position.grossPerformance?.toNumber(), currency, userCurrency ); const netPerformance = this.exchangeRateDataService.toCurrency( - position.netPerformance.toNumber(), + position.netPerformance?.toNumber(), currency, userCurrency );