oschwald / maxminddb-golang

MaxMind DB Reader for Go
ISC License
597 stars 101 forks source link

Allow unmarshalling to nil struct pointers in parent struct #24

Closed oschwald closed 8 years ago

oschwald commented 8 years ago

This apparently does not work at the moment.

panic: reflect: call of reflect.Value.Type on zero Value

goroutine 1 [running]:
panic(0x81d3e0, 0xc82012aa80)
    /usr/local/go/src/runtime/panic.go:464 +0x3e6
reflect.Value.Type(0x0, 0x0, 0x0, 0x0, 0x0)
    /usr/local/go/src/reflect/value.go:1671 +0x7b
github.com/oschwald/maxminddb-golang.(*decoder).unmarshalMap(0xc8200b48e0, 0x2, 0x432, 0x0, 0x0, 0x0, 0x42e, 0x0, 0x0)
    /home/greg/MaxMind/go/src/github.com/oschwald/maxminddb-golang/decoder.go:241 +0x2b1
github.com/oschwald/maxminddb-golang.(*decoder).decodeFromType(0xc8200b48e0, 0x7, 0x2, 0x432, 0x0, 0x0, 0x0, 0x7efcc5c5088d, 0x0, 0x0)
    /home/greg/MaxMind/go/src/github.com/oschwald/maxminddb-golang/decoder.go:104 +0x4bf
github.com/oschwald/maxminddb-golang.(*decoder).decode(0xc8200b48e0, 0x431, 0x8664c0, 0xc82012c600, 0x196, 0xc82012c600, 0x0, 0x0)
    /home/greg/MaxMind/go/src/github.com/oschwald/maxminddb-golang/decoder.go:43 +0x1c2
github.com/oschwald/maxminddb-golang.(*decoder).decodeStruct(0xc8200b48e0, 0x6, 0x431, 0x891800, 0xc82012c600, 0x199, 0x42e, 0x0, 0x0)
    /home/greg/MaxMind/go/src/github.com/oschwald/maxminddb-golang/decoder.go:493 +0x557
github.com/oschwald/maxminddb-golang.(*decoder).unmarshalMap(0xc8200b48e0, 0x6, 0x42f, 0x891800, 0xc82012c600, 0x199, 0x9, 0x0, 0x0)
    /home/greg/MaxMind/go/src/github.com/oschwald/maxminddb-golang/decoder.go:243 +0x254
github.com/oschwald/maxminddb-golang.(*decoder).decodeFromType(0xc8200b48e0, 0x7, 0x6, 0x42f, 0x891800, 0xc82012c600, 0x199, 0x0, 0x0, 0x0)
    /home/greg/MaxMind/go/src/github.com/oschwald/maxminddb-golang/decoder.go:104 +0x4bf
github.com/oschwald/maxminddb-golang.(*decoder).decode(0xc8200b48e0, 0x42e, 0x866100, 0xc82012c600, 0x16, 0x18, 0x0, 0x0)
    /home/greg/MaxMind/go/src/github.com/oschwald/maxminddb-golang/decoder.go:43 +0x1c2
github.com/oschwald/maxminddb-golang.(*Reader).Decode(0xc8200b48c0, 0x42e, 0x866100, 0xc82012c600, 0x0, 0x0)
    /home/greg/MaxMind/go/src/github.com/oschwald/maxminddb-golang/reader.go:151 +0x135
main.createCachedDb(0xc82007d200, 0x0, 0x0)
oschwald commented 8 years ago

Closed by 5a39e6c04a09b3c909f9ebf6d8b399998d790343