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 }