[NOD-915] Check if lockableFile underlying file is nil before closing it (#709)

This commit is contained in:
Ori Newman 2020-04-30 14:43:38 +03:00 committed by GitHub
parent 3c89e1f7b3
commit 2ef5c2cbac
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -36,5 +36,9 @@ func (lf *lockableFile) Close() error {
lf.Lock()
defer lf.Unlock()
if lf.file == nil {
return nil
}
return errors.WithStack(lf.file.Close())
}