1
0
mirror of https://github.com/fumiama/WireGold.git synced 2026-06-12 12:50:28 +08:00

fix(nat): panic on nil endpoint

This commit is contained in:
源文雨
2025-02-22 20:45:27 +09:00
parent 85a90aeb86
commit 60495227fc
5 changed files with 16 additions and 11 deletions

View File

@@ -1,6 +1,7 @@
package helper
import (
"reflect"
"unsafe"
)
@@ -30,3 +31,11 @@ func StringToBytes(s string) (b []byte) {
bh.cap = sh.len
return b
}
func IsNilInterface(x any) bool {
return x == nil || reflect.ValueOf(x).IsZero()
}
func IsNonNilInterface(x any) bool {
return !IsNilInterface(x)
}