forked from mirror/go-json
Fix bugs of nil pointer of typeAddr value
This commit is contained in:
parent
094f8da49e
commit
f4a7cdf543
|
@ -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