Prevent error when the error message is empty

This commit is contained in:
Arnaud 2025-10-27 10:52:03 +01:00
parent 7a23643e30
commit 6e2944ff09
No known key found for this signature in database
GPG Key ID: B8FBC178F10CA7AE

View File

@ -69,6 +69,9 @@ proc handleRes[T: string | void | seq[byte]](
if res.isErr():
foreignThreadGc:
let msg = $res.error
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
)