fix: Guard actions and triggers properties of apps

This commit is contained in:
Faruk AYDIN
2024-03-17 12:45:31 +01:00
parent 479f3e3172
commit 73a5b8553f

View File

@@ -165,7 +165,7 @@ class Step extends Base {
if (!isTrigger || !appKey || !key) return null; if (!isTrigger || !appKey || !key) return null;
const app = await App.findOneByKey(appKey); const app = await App.findOneByKey(appKey);
const command = app.triggers.find((trigger) => trigger.key === key); const command = app.triggers?.find((trigger) => trigger.key === key);
return command; return command;
} }
@@ -175,7 +175,7 @@ class Step extends Base {
if (!isAction || !appKey || !key) return null; if (!isAction || !appKey || !key) return null;
const app = await App.findOneByKey(appKey); const app = await App.findOneByKey(appKey);
const command = app.actions.find((action) => action.key === key); const command = app.actions?.find((action) => action.key === key);
return command; return command;
} }