Skip to content

Commit 67939ef

Browse files
authored
Fix #15 and #17, script crashing application (#16)
* Fix #5, `script` crashing application * removed unused import * style
1 parent 26c07e0 commit 67939ef

1 file changed

Lines changed: 2 additions & 4 deletions

File tree

webui.nim

Lines changed: 2 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -7,8 +7,6 @@
77
See: https://neroist.github.io/webui-docs/
88
]##
99

10-
import std/strutils
11-
1210
from webui/bindings import nil
1311

1412
type
@@ -256,9 +254,9 @@ proc script*(window: Window; script: string; timeout: int = 0, bufferLen: static
256254
var buffer: array[bufferLen, char]
257255

258256
let
259-
error = bindings.script(csize_t window, cstring script, csize_t timeout, cast[cstring](addr buffer), csize_t bufferLen)
257+
error = bindings.script(csize_t window, cstring script, csize_t timeout, cast[cstring](addr buffer[0]), csize_t bufferLen)
260258

261-
data = buffer.join().strip(leading = false, chars = {'\x00'}) # remove trailing null chars
259+
data = $(cast[cstring](addr buffer[0])) # remove trailing null chars
262260

263261
result.data = data
264262
result.error = not error

0 commit comments

Comments
 (0)