summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authortrustable-code <krauter.simon@arcor.de>2020-04-12 19:10:42 +0200
committertrustable-code <krauter.simon@arcor.de>2020-04-12 19:10:42 +0200
commit4480cd6b13edd9fa6e8f270ebd2ffd6cab8296c7 (patch)
treefc2dba2b893c3eb465049ea61fa4956014bcabe9
parenta54e55a935cd1f8da050750c1d52e5ed07417f97 (diff)
downloadNiGui-4480cd6b13edd9fa6e8f270ebd2ffd6cab8296c7.tar.gz
NiGui-4480cd6b13edd9fa6e8f270ebd2ffd6cab8296c7.zip
Fixes: Wine: Crash when getting the text field of an empty TextBox/TextArea #96
-rwxr-xr-xsrc/nigui/private/windows/platform_impl.nim2
1 files changed, 2 insertions, 0 deletions
diff --git a/src/nigui/private/windows/platform_impl.nim b/src/nigui/private/windows/platform_impl.nim
index d08800d..b0e23c4 100755
--- a/src/nigui/private/windows/platform_impl.nim
+++ b/src/nigui/private/windows/platform_impl.nim
@@ -108,6 +108,8 @@ proc pSetWindowText(hWnd: pointer, s: string) =
proc pGetWindowText(hWnd: pointer): string =
let characters = GetWindowTextLengthW(hWnd)
+ if characters == 0:
+ return
result = newString(characters * 2)
var res = GetWindowTextW(hWnd, result, characters * 2 + 1)
if res != characters: pRaiseLastOSError()