A local-first personal finance app
fix crash when using bulk amount update (#5360)
Matt Fiddaman9aed1f400c89
diff --git a/packages/desktop-client/src/components/modals/EditFieldModal.tsx b/packages/desktop-client/src/components/modals/EditFieldModal.tsxindex 2a2e108f36..182b06bc36 100644--- a/packages/desktop-client/src/components/modals/EditFieldModal.tsx+++ b/packages/desktop-client/src/components/modals/EditFieldModal.tsx@@ -14,7 +14,7 @@ import { View } from '@actual-app/components/view';import { parseISO, format as formatDate, parse as parseDate } from 'date-fns';import { currentDay, dayFromDate } from 'loot-core/shared/months';-import { amountToInteger } from 'loot-core/shared/util';+import { amountToInteger, currencyToInteger } from 'loot-core/shared/util';import {Modal,@@ -58,8 +58,17 @@ export function EditFieldModal({function onSelect(value: string | number) {if (value != null) {// Process the value if needed- if (name === 'amount' && typeof value === 'number') {- value = amountToInteger(value);+ if (name === 'amount') {+ if (typeof value === 'string') {+ const parsed = currencyToInteger(value);+ if (parsed === null) {+ alert(t('Invalid amount value'));+ return;+ }+ value = parsed;+ } else if (typeof value === 'number') {+ value = amountToInteger(value);+ }}onSubmit(name, value);diff --git a/upcoming-release-notes/5360.md b/upcoming-release-notes/5360.mdnew file mode 100644index 0000000000..a52158108d--- /dev/null+++ b/upcoming-release-notes/5360.md@@ -0,0 +1,6 @@+---+category: Bugfix+authors: [matt-fidd]+---++Fix crash when using bulk amount update