mirror of
https://github.com/nspcc-dev/neo-go.git
synced 2024-11-22 09:29:38 +00:00
storage: bytes.Clone(nil) == nil
Signed-off-by: Roman Khimov <roman@nspcc.ru>
This commit is contained in:
parent
13020ccd02
commit
502f024e7c
1 changed files with 1 additions and 4 deletions
|
@ -77,11 +77,8 @@ func NewBoltDBStore(cfg dbconfig.BoltDBOptions) (*BoltDBStore, error) {
|
||||||
func (s *BoltDBStore) Get(key []byte) (val []byte, err error) {
|
func (s *BoltDBStore) Get(key []byte) (val []byte, err error) {
|
||||||
err = s.db.View(func(tx *bbolt.Tx) error {
|
err = s.db.View(func(tx *bbolt.Tx) error {
|
||||||
b := tx.Bucket(Bucket)
|
b := tx.Bucket(Bucket)
|
||||||
val = b.Get(key)
|
|
||||||
// Value from Get is only valid for the lifetime of transaction, #1482
|
// Value from Get is only valid for the lifetime of transaction, #1482
|
||||||
if val != nil {
|
val = bytes.Clone(b.Get(key))
|
||||||
val = bytes.Clone(val)
|
|
||||||
}
|
|
||||||
return nil
|
return nil
|
||||||
})
|
})
|
||||||
if val == nil {
|
if val == nil {
|
||||||
|
|
Loading…
Reference in a new issue