Fix bugs of nil pointer of typeAddr value

This commit is contained in:
Masaaki Goshima 2021-03-20 18:24:13 +09:00
parent 094f8da49e
commit f4a7cdf543
1 changed files with 4 additions and 1 deletions

View File

@ -19,11 +19,14 @@ var (
jsonNumberType = reflect.TypeOf(json.Number(""))
cachedOpcodeSets []*OpcodeSet
cachedOpcodeMap unsafe.Pointer // map[uintptr]*OpcodeSet
typeAddr = &runtime.TypeAddr{}
typeAddr *runtime.TypeAddr
)
func init() {
typeAddr = runtime.AnalyzeTypeAddr()
if typeAddr == nil {
typeAddr = &runtime.TypeAddr{}
}
cachedOpcodeSets = make([]*OpcodeSet, typeAddr.AddrRange)
}