avoid nil when closing an index

fix https://github.com/chrislusf/seaweedfs/issues/1870
This commit is contained in:
Chris Lu 2021-03-07 11:03:09 -08:00
parent bdfed16d42
commit 726edab054

View file

@ -94,8 +94,12 @@ func (m *SortedFileNeedleMap) Delete(key NeedleId, offset Offset) error {
}
func (m *SortedFileNeedleMap) Close() {
m.indexFile.Close()
m.dbFile.Close()
if m.indexFile != nil {
m.indexFile.Close()
}
if m.dbFile != nil {
m.dbFile.Close()
}
}
func (m *SortedFileNeedleMap) Destroy() error {