mirror of https://github.com/goccy/go-json.git
Merge pull request #156 from goccy/feature/fix-compiler-bug
Fix bugs of nil pointer of typeAddr value
This commit is contained in:
commit
16f6c377b4
|
@ -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)
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue