fix(package): added an array check on callback args (#85)

-> Issue is that if callaback returns a null value it errors and fails
This commit is contained in:
Maximus7474
2026-02-11 18:07:42 +01:00
committed by GitHub
parent fdc1674f4f
commit e66b6805bc
2 changed files with 2 additions and 2 deletions

View File

@@ -47,7 +47,7 @@ export function triggerServerCallback<T = unknown>(
return new Promise<T>((resolve, reject) => {
pendingCallbacks[key] = (args) => {
if (args[0] === 'cb_invalid') reject(`callback '${eventName} does not exist`);
if (Array.isArray(args) && args[0] === 'cb_invalid') reject(`callback '${eventName} does not exist`);
resolve(args);
};

View File

@@ -29,7 +29,7 @@ export function triggerClientCallback<T = unknown>(
return new Promise<T>((resolve, reject) => {
pendingCallbacks[key] = (args) => {
if (args[0] === 'cb_invalid') reject(`callback '${eventName} does not exist`);
if (Array.isArray(args) && args[0] === 'cb_invalid') reject(`callback '${eventName} does not exist`);
resolve(args);
};