fix reader nil pointer
This commit is contained in:
parent
adca23eea0
commit
b2940955ab
14
tail.go
14
tail.go
|
@ -143,11 +143,17 @@ func (tail *Tail) Tell() (offset int64, err error) {
|
||||||
return
|
return
|
||||||
}
|
}
|
||||||
offset, err = tail.file.Seek(0, os.SEEK_CUR)
|
offset, err = tail.file.Seek(0, os.SEEK_CUR)
|
||||||
if err == nil {
|
if err != nil {
|
||||||
tail.lk.Lock()
|
return
|
||||||
offset -= int64(tail.reader.Buffered())
|
|
||||||
tail.lk.Unlock()
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
tail.lk.Lock()
|
||||||
|
defer tail.lk.Unlock()
|
||||||
|
if tail.reader == nil {
|
||||||
|
return
|
||||||
|
}
|
||||||
|
|
||||||
|
offset -= int64(tail.reader.Buffered())
|
||||||
return
|
return
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue