Skip to content

A local-first personal finance app

prevent GoCardless sync failure when invalid account information is received (#6296)

Matt Fiddamanbaacf0900f28
diff --git a/packages/loot-core/src/server/transactions/index.ts b/packages/loot-core/src/server/transactions/index.ts
index e96ff895e1..d99ad0bc14 100644
--- a/packages/loot-core/src/server/transactions/index.ts
+++ b/packages/loot-core/src/server/transactions/index.ts
@@ -83,7 +83,7 @@ export async function batchUpdateTransactions({
added.map(async t => {
// Offbudget account transactions and parent transactions should not have categories.
const account = accounts.find(acct => acct.id === t.account);
- if (t.is_parent || account.offbudget === 1) {
+ if (t.is_parent || account?.offbudget === 1) {
t.category = null;
}
return db.insertTransaction(t);
@@ -110,7 +110,7 @@ export async function batchUpdateTransactions({
// Moving transactions off budget should always clear the
// category. Parent transactions should not have categories.
const account = accounts.find(acct => acct.id === t.account);
- if (t.is_parent || account.offbudget === 1) {
+ if (t.is_parent || account?.offbudget === 1) {
t.category = null;
}
}
diff --git a/upcoming-release-notes/6296.md b/upcoming-release-notes/6296.md
new file mode 100644
index 0000000000..c626eb5963
--- /dev/null
+++ b/upcoming-release-notes/6296.md
@@ -0,0 +1,6 @@
+---
+category: Bugfix
+authors: [matt-fidd]
+---
+
+Fix failing GoCardless sync when incorrect account information is received