diff options
| author | trustable-code <krauter.simon@arcor.de> | 2020-04-12 19:10:42 +0200 |
|---|---|---|
| committer | trustable-code <krauter.simon@arcor.de> | 2020-04-12 19:10:42 +0200 |
| commit | 4480cd6b13edd9fa6e8f270ebd2ffd6cab8296c7 (patch) | |
| tree | fc2dba2b893c3eb465049ea61fa4956014bcabe9 | |
| parent | a54e55a935cd1f8da050750c1d52e5ed07417f97 (diff) | |
| download | NiGui-4480cd6b13edd9fa6e8f270ebd2ffd6cab8296c7.tar.gz NiGui-4480cd6b13edd9fa6e8f270ebd2ffd6cab8296c7.zip | |
Fixes: Wine: Crash when getting the text field of an empty TextBox/TextArea #96
| -rwxr-xr-x | src/nigui/private/windows/platform_impl.nim | 2 |
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() |
