avoid nil exception

fix https://github.com/chrislusf/seaweedfs/issues/1869
This commit is contained in:
Chris Lu 2021-03-07 01:49:06 -08:00
parent 1bd880dcdb
commit bdfed16d42

View file

@ -152,8 +152,10 @@ func (m *LevelDbNeedleMap) Close() {
glog.Warningf("close index file %s failed: %v", indexFileName, err) glog.Warningf("close index file %s failed: %v", indexFileName, err)
} }
if err := m.db.Close(); err != nil { if m.db != nil {
glog.Warningf("close levelDB failed: %v", err) if err := m.db.Close(); err != nil {
glog.Warningf("close levelDB failed: %v", err)
}
} }
} }