state: initialize PublicKey before decoding into it, fix #1061

These are pointers and decoding into a nil pointer is a bad idea.
This commit is contained in:
Roman Khimov 2020-06-18 21:59:58 +03:00
parent dd6895b103
commit 90d3bcbdc3

View file

@ -125,6 +125,7 @@ func (s *NEOBalanceState) fromStackItem(item stackitem.Item) {
votes := structItem[2].Value().([]stackitem.Item)
s.Votes = make([]*keys.PublicKey, len(votes))
for i, v := range votes {
s.Votes[i] = new(keys.PublicKey)
s.Votes[i].DecodeBytes(v.Value().([]byte))
}
}