Skip to content

Commit

Permalink
Merge pull request #3877 from Kelimion/wstring_fix
Browse files Browse the repository at this point in the history
Fix utf8_to_wstring given zero bytes.
  • Loading branch information
Kelimion authored Jul 5, 2024
2 parents c8432df + 9ecc335 commit ecffe5a
Showing 1 changed file with 2 additions and 2 deletions.
4 changes: 2 additions & 2 deletions core/sys/windows/util.odin
Original file line number Diff line number Diff line change
Expand Up @@ -53,8 +53,8 @@ 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 {
return &res[0]
if res := utf8_to_utf16(s, allocator); len(res) > 0 {
return raw_data(res)
}
return nil
}
Expand Down

0 comments on commit ecffe5a

Please sign in to comment.