Skip to content

Commit

Permalink
Prevent schedules with null amounts from crashing the app (#3958)
Browse files Browse the repository at this point in the history
* test

* note

* add comment
  • Loading branch information
matt-fidd authored Dec 18, 2024
1 parent 11bde73 commit 4ce5e2f
Show file tree
Hide file tree
Showing 2 changed files with 10 additions and 0 deletions.
4 changes: 4 additions & 0 deletions packages/loot-core/src/shared/schedules.ts
Original file line number Diff line number Diff line change
Expand Up @@ -276,6 +276,10 @@ export function getScheduledAmount(
amount: number | { num1: number; num2: number },
inverse: boolean = false,
): number {
// this check is temporary, and required at the moment as a schedule rule
// allows the amount condition to be deleted which causes a crash
if (amount == null) return 0;

if (typeof amount === 'number') {
return inverse ? -amount : amount;
}
Expand Down
6 changes: 6 additions & 0 deletions upcoming-release-notes/3958.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
---
category: Bugfix
authors: [matt-fidd]
---

Prevent schedules with null amounts from crashing the app

0 comments on commit 4ce5e2f

Please sign in to comment.