leveldb: fix nil deref

This commit is contained in:
Martin Holst Swende 2019-10-23 17:48:35 +02:00
parent 1fb58b2ac1
commit 7f3956152d
No known key found for this signature in database
GPG key ID: 683B438C05A5DDF0

View file

@ -455,7 +455,9 @@ func (b *batch) ValueSize() int {
// Write flushes any accumulated data to disk. // Write flushes any accumulated data to disk.
func (b *batch) Write() error { func (b *batch) Write() error {
if b.writeGauge != nil {
b.writeGauge.Inc(1) b.writeGauge.Inc(1)
}
return b.db.Write(b.b, nil) return b.db.Write(b.b, nil)
} }