Browse Source

boltDB AtomicDelete fails for non-existent key

Signed-off-by: Santhosh Manohar <santhosh@docker.com>
Santhosh Manohar 9 years ago
parent
commit
f06f78e638
1 changed files with 3 additions and 0 deletions
  1. 3 0
      libnetwork/internal/kvstore/boltdb/boltdb.go

+ 3 - 0
libnetwork/internal/kvstore/boltdb/boltdb.go

@@ -330,6 +330,9 @@ func (b *BoltDB) AtomicDelete(key string, previous *store.KVPair) (bool, error)
 		}
 
 		val = bucket.Get([]byte(key))
+		if val == nil {
+			return store.ErrKeyNotFound
+		}
 		dbIndex := binary.LittleEndian.Uint64(val[:libkvmetadatalen])
 		if dbIndex != previous.LastIndex {
 			return store.ErrKeyModified