Skip to content

A local-first personal finance app

fix: make sure cumulative value can not be undefined (#5738)

Michael Süssemilch98b91cfb8da2
diff --git a/packages/desktop-client/src/components/reports/graphs/SpendingGraph.tsx b/packages/desktop-client/src/components/reports/graphs/SpendingGraph.tsx
index a02d7a62bf..22f099860b 100644
--- a/packages/desktop-client/src/components/reports/graphs/SpendingGraph.tsx
+++ b/packages/desktop-client/src/components/reports/graphs/SpendingGraph.tsx
@@ -63,7 +63,7 @@ const CustomTooltip = ({
if (active && payload && payload.length) {
const comparison = ['average', 'budget'].includes(selection)
? payload[0].payload[selection] * -1
- : payload[0].payload.months[selection]?.cumulative * -1;
+ : (payload[0].payload.months[selection]?.cumulative ?? 0) * -1;
return (
<div
className={css({
diff --git a/upcoming-release-notes/5738.md b/upcoming-release-notes/5738.md
new file mode 100644
index 0000000000..a416687136
--- /dev/null
+++ b/upcoming-release-notes/5738.md
@@ -0,0 +1,6 @@
+---
+category: Bugfix
+authors: [misu-dev]
+---
+
+Fixes Spending Card crash