Prevent error when the error message is empty

This commit is contained in:
Arnaud 2025-10-27 10:52:03 +01:00 committed by Eric
parent fbd466b4cd
commit d9f53d0056
No known key found for this signature in database

View File

@ -69,9 +69,12 @@ proc handleRes[T: string | void | seq[byte]](
if res.isErr():
foreignThreadGc:
let msg = $res.error
request[].callback(
RET_ERR, unsafeAddr msg[0], cast[csize_t](len(msg)), request[].userData
)
if msg == "":
request[].callback(RET_ERR, nil, cast[csize_t](0), request[].userData)
else:
request[].callback(
RET_ERR, unsafeAddr msg[0], cast[csize_t](len(msg)), request[].userData
)
return
foreignThreadGc: