windows: UTF16PtrToString explicitly return empty string for a ptr to NULL terminator

This commit is contained in:
Yaroslav Vorobiov
2020-05-05 14:48:15 +03:00
parent 0e31a5ef58
commit 73c410a3a0

View File

@@ -126,6 +126,10 @@ func UTF16PtrToString(p *uint16) string {
if p == nil {
return ""
}
if *p == 0 {
return ""
}
// Find NUL terminator.
n := 0
for ptr := unsafe.Pointer(p); *(*uint16)(ptr) != 0; n++ {