From fdcc612b3d53121d475d10a47afe482f461d3c92 Mon Sep 17 00:00:00 2001 From: Il Harper Date: Tue, 5 Mar 2024 20:33:28 +0800 Subject: [PATCH] fix(event): fix ipcman --- packages/engine-chronocat-event/src/index.ts | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-) diff --git a/packages/engine-chronocat-event/src/index.ts b/packages/engine-chronocat-event/src/index.ts index 85792de..998a1df 100644 --- a/packages/engine-chronocat-event/src/index.ts +++ b/packages/engine-chronocat-event/src/index.ts @@ -135,8 +135,12 @@ export const apply = async (ctx: ChronocatContext) => { const handler = (data: IpcManData) => { switch (data.type) { case 'event': { - const d = data.args[1] as RedIpcDataEvent - void dispatcher(d.cmdName, d.payload) + if (!data.args[1] || !Array.isArray(data.args[1])) return + const d = data.args[1] as [RedIpcDataEvent] + if (!d.length) return + const e = d[0] + if (!e || !('cmdName' in e)) return + void dispatcher(e.cmdName, e.payload) return }