Distinguish between ReadJSON vs ReadJSONPtr. The latter expects a non-nil pointer to write into. The former creates new things intelligently

This commit is contained in:
Jae Kwon
2015-07-11 16:32:46 -07:00
parent 4504e6a9f4
commit 24acda1afc
4 changed files with 33 additions and 5 deletions

View File

@ -69,7 +69,7 @@ func NewNode() *Node {
} else {
genDocBytes := stateDB.Get(sm.GenDocKey)
err := new(error)
binary.ReadJSON(&genDoc, genDocBytes, err)
binary.ReadJSONPtr(&genDoc, genDocBytes, err)
if *err != nil {
panic(Fmt("Unable to read gendoc from db: %v", err))
}