mirror of
https://github.com/golang/sys.git
synced 2026-02-09 04:06:04 +03:00
windows: UTF16PtrToString explicitly return empty string for a ptr to NULL terminator
This commit is contained in:
@@ -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++ {
|
||||
|
||||
Reference in New Issue
Block a user