From f79581d97e52a118e2f7c5ea80cf31d53014e9ad Mon Sep 17 00:00:00 2001 From: linyuchen Date: Fri, 15 Nov 2024 10:58:35 +0800 Subject: [PATCH] =?UTF-8?q?:bug:=E4=BF=AE=E5=A4=8D=20hook=20ipc=20?= =?UTF-8?q?=E6=97=B6=E8=8E=B7=E5=8F=96=E4=B8=8D=E5=88=B0=20callbackId=20?= =?UTF-8?q?=E5=AF=BC=E8=87=B4=E5=85=B6=E4=BB=96=E6=8F=92=E4=BB=B6=20ipc=20?= =?UTF-8?q?=E9=80=9A=E4=BF=A1=E5=A4=B1=E8=B4=A5?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- src/ntqqapi/hook.ts | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/src/ntqqapi/hook.ts b/src/ntqqapi/hook.ts index eb36206..9443019 100644 --- a/src/ntqqapi/hook.ts +++ b/src/ntqqapi/hook.ts @@ -58,14 +58,14 @@ export function startHook() { event.sender[senderExclude] = true event.sender.send = new Proxy(event.sender.send, { apply(target, thisArg, args: [channel: string, meta: Dict, data: Dict[]]) { - if (args[1].eventName?.startsWith('ns-LoggerApi')) { + if (args[1]?.eventName?.startsWith('ns-LoggerApi')) { return target.apply(thisArg, args) } if (logHook) { log('received', args) } - const callbackId = args[1].callbackId + const callbackId = args[1]?.callbackId if (callbackId) { if (hookApiCallbacks[callbackId]) { Promise.resolve(hookApiCallbacks[callbackId](args[2])) @@ -97,7 +97,7 @@ export function startHook() { } } return target.apply(thisArg, args) - } + }, }) }