diff options
| author | Jeroen van Rijn <Kelimion@users.noreply.github.com> | 2024-07-05 13:46:07 +0200 |
|---|---|---|
| committer | Jeroen van Rijn <Kelimion@users.noreply.github.com> | 2024-07-05 13:46:07 +0200 |
| commit | 164a5e587eaf51b23b8308ea4900f59338bdb6f5 (patch) | |
| tree | 15dd7d79895d15ff8d03a5773a3b6caa80105d54 /core/sys/windows/util.odin | |
| parent | c8432df2481d6cb38e8aa6beab55a7791d149975 (diff) | |
Fix utf8_to_wstring given zero bytes.
Diffstat (limited to 'core/sys/windows/util.odin')
| -rw-r--r-- | core/sys/windows/util.odin | 5 |
1 files changed, 4 insertions, 1 deletions
diff --git a/core/sys/windows/util.odin b/core/sys/windows/util.odin index c68d58de0..348eb9e5f 100644 --- a/core/sys/windows/util.odin +++ b/core/sys/windows/util.odin @@ -53,8 +53,11 @@ utf8_to_utf16 :: proc(s: string, allocator := context.temp_allocator) -> []u16 { return text[:n] } utf8_to_wstring :: proc(s: string, allocator := context.temp_allocator) -> wstring { - if res := utf8_to_utf16(s, allocator); res != nil { + if res := utf8_to_utf16(s, allocator); len(res) > 0 { return &res[0] + } else { + delete(res, allocator) + return nil } return nil } |