From bfaf1e61e4b1bee75ea5f80365e2dee87535bbcb Mon Sep 17 00:00:00 2001 From: Mel O'Hagan Date: Fri, 19 Aug 2022 14:52:50 +0100 Subject: [PATCH 1/2] Null safety --- .../src/components/automation/SetupPanel/FieldSelector.svelte | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/packages/builder/src/components/automation/SetupPanel/FieldSelector.svelte b/packages/builder/src/components/automation/SetupPanel/FieldSelector.svelte index f510d961fb..3920885a2e 100644 --- a/packages/builder/src/components/automation/SetupPanel/FieldSelector.svelte +++ b/packages/builder/src/components/automation/SetupPanel/FieldSelector.svelte @@ -14,7 +14,7 @@ $: { let fields = {} - for (const [key, type] of Object.entries(block?.inputs?.fields)) { + for (const [key, type] of Object.entries(block?.inputs?.fields ?? {})) { fields = { ...fields, [key]: { From ef7b7079b00bb920462ac87e3db6997eb9c36d5f Mon Sep 17 00:00:00 2001 From: Mel O'Hagan Date: Fri, 19 Aug 2022 14:57:15 +0100 Subject: [PATCH 2/2] tableId null safety --- packages/server/src/automations/steps/queryRows.js | 8 ++++++++ 1 file changed, 8 insertions(+) diff --git a/packages/server/src/automations/steps/queryRows.js b/packages/server/src/automations/steps/queryRows.js index b02f31b1ec..cfff039221 100644 --- a/packages/server/src/automations/steps/queryRows.js +++ b/packages/server/src/automations/steps/queryRows.js @@ -125,6 +125,14 @@ const hasNullFilters = filters => exports.run = async function ({ inputs, appId }) { const { tableId, filters, sortColumn, sortOrder, limit } = inputs + if (!tableId) { + return { + success: false, + response: { + message: "You must select a table to query.", + }, + } + } const table = await getTable(appId, tableId) let sortType = FieldTypes.STRING if (table && table.schema && table.schema[sortColumn] && sortColumn) {