mirror of
https://github.com/CommunityOx/ox_lib.git
synced 2026-08-17 06:56:03 +01:00
fix(callback): bad argument to unpack when callback throws error
Throwing an error responds with false rather than a string.
This commit is contained in:
@@ -50,7 +50,7 @@ local function triggerServerCallback(_, event, delay, cb, ...)
|
||||
return promise:resolve(response and { msgpack.unpack(response) } or {})
|
||||
end
|
||||
|
||||
return cb and cb(msgpack.unpack(response))
|
||||
return cb and cb(response and msgpack.unpack(response))
|
||||
end
|
||||
|
||||
if promise then
|
||||
|
||||
@@ -31,7 +31,7 @@ local function triggerClientCallback(_, event, playerId, cb, ...)
|
||||
return promise:resolve(response and { msgpack.unpack(response) } or {})
|
||||
end
|
||||
|
||||
return cb and cb(msgpack.unpack(response))
|
||||
return cb and cb(response and msgpack.unpack(response))
|
||||
end
|
||||
|
||||
if promise then
|
||||
@@ -74,4 +74,6 @@ function lib.callback.register(name, cb)
|
||||
end)
|
||||
end
|
||||
|
||||
return lib.callback
|
||||
return lib.callback
|
||||
|
||||
|
||||
|
||||
Reference in New Issue
Block a user