Skip to content

Open Source Wealth Management Software. Angular + NestJS + Prisma + Nx + TypeScript 🤍

Bugfix/fix cannot read properties of undefined reading items in get position (#2667)

Thomas Kaul8898d0244270
diff --git a/CHANGELOG.md b/CHANGELOG.md
index 4f5fae02f0..2ca0f9fbd5 100644
--- a/CHANGELOG.md
+++ b/CHANGELOG.md
@@ -15,6 +15,10 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0
- Upgraded `http-status-codes` from version `2.2.0` to `2.3.0`
+### Fixed
+
+- Handled reading items from missing transaction point while getting the position (`getPosition()`) in portfolio service
+
## 2.24.0 - 2023-11-16
### Changed
diff --git a/apps/api/src/app/portfolio/portfolio.service.ts b/apps/api/src/app/portfolio/portfolio.service.ts
index 5252732537..2a701aab5c 100644
--- a/apps/api/src/app/portfolio/portfolio.service.ts
+++ b/apps/api/src/app/portfolio/portfolio.service.ts
@@ -879,7 +879,7 @@ export class PortfolioService {
let currentAveragePrice = 0;
let currentQuantity = 0;
- const currentSymbol = transactionPoints[j].items.find(
+ const currentSymbol = transactionPoints[j]?.items.find(
({ symbol }) => {
return symbol === aSymbol;
}