Merge pull request #156 from goccy/feature/fix-compiler-bug

Fix bugs of nil pointer of typeAddr value
This commit is contained in:
Masaaki Goshima 2021-03-20 18:41:47 +09:00 committed by GitHub
commit 16f6c377b4
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
1 changed files with 4 additions and 1 deletions

View File

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