backup: Lock the buffer lines in Backup()

This commit is contained in:
Jöran Karl
2024-05-24 20:19:55 +02:00
parent 0b871e174f
commit 42ae05b082

View File

@@ -82,6 +82,9 @@ func (b *Buffer) Backup() error {
name := filepath.Join(backupdir, util.EscapePath(b.AbsPath))
err = overwriteFile(name, encoding.Nop, func(file io.Writer) (e error) {
b.Lock()
defer b.Unlock()
if len(b.lines) == 0 {
return
}