From a2892270d23917c2ba74e45206d7b1d775f8fbd1 Mon Sep 17 00:00:00 2001 From: Matiss Janis Aboltins Date: Mon, 9 Dec 2024 22:00:36 +0000 Subject: [PATCH] :bug: fix condition "notes contains (nothing)" throwing error (#3943) --- packages/loot-core/src/server/accounts/transaction-rules.ts | 6 +++++- upcoming-release-notes/3943.md | 6 ++++++ 2 files changed, 11 insertions(+), 1 deletion(-) create mode 100644 upcoming-release-notes/3943.md diff --git a/packages/loot-core/src/server/accounts/transaction-rules.ts b/packages/loot-core/src/server/accounts/transaction-rules.ts index 2c2569a5fc8..cfa534ef7ce 100644 --- a/packages/loot-core/src/server/accounts/transaction-rules.ts +++ b/packages/loot-core/src/server/accounts/transaction-rules.ts @@ -291,7 +291,11 @@ export async function runRules(trans) { return await finalizeTransactionForRules(finalTrans); } -function conditionSpecialCases(cond: Condition): Condition { +function conditionSpecialCases(cond: Condition | null): Condition | null { + if (!cond) { + return cond; + } + //special cases that require multiple conditions if (cond.op === 'is' && cond.field === 'category' && cond.value === null) { return new Condition( diff --git a/upcoming-release-notes/3943.md b/upcoming-release-notes/3943.md new file mode 100644 index 00000000000..988e0ac840c --- /dev/null +++ b/upcoming-release-notes/3943.md @@ -0,0 +1,6 @@ +--- +category: Bugfix +authors: [MatissJanis] +--- + +Fix rule creation throwing error for "notes contains (nothing)" condition.