diff options
Diffstat (limited to 'src/js')
-rw-r--r-- | src/js/javascript.nim | 2 |
1 files changed, 1 insertions, 1 deletions
diff --git a/src/js/javascript.nim b/src/js/javascript.nim index 5bffbdbd..0d86bd71 100644 --- a/src/js/javascript.nim +++ b/src/js/javascript.nim @@ -227,7 +227,7 @@ proc setInterruptHandler*(rt: JSRuntime, cb: JSInterruptHandler, opaque: pointer func toString*(ctx: JSContext, val: JSValue): Option[string] = var plen: csize_t let outp = JS_ToCStringLen(ctx, addr plen, val) # cstring - if outp != nil: + if outp != nil and plen != 0: var ret = newString(plen) copyMem(addr ret[0], outp, plen) result = some(ret) |