From 475dda3e92a34cdecd8a7f713de8b0a84f276299 Mon Sep 17 00:00:00 2001 From: "cangzhen.dsj" Date: Mon, 24 Jan 2022 16:45:17 +0800 Subject: [PATCH] Fix removeNull for empty strings --- hsperfdata.go | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/hsperfdata.go b/hsperfdata.go index 3025f39..86b61cf 100644 --- a/hsperfdata.go +++ b/hsperfdata.go @@ -218,7 +218,7 @@ func DataPathsByProcessName(processName string) (map[string]string, error) { // removeNull remove trailing '\x00' byte of s func removeNull(s []byte) []byte { - if i := bytes.IndexByte(s, '\x00'); i > 0 { + if i := bytes.IndexByte(s, '\x00'); i >= 0 { return s[:i] } return s