!602 Tailer当文件内容为空时,会报异常

Merge pull request !602 from 熊毅/v5-dev
This commit is contained in:
Looly 2022-04-27 03:23:59 +00:00 committed by Gitee
commit d4779655ad
No known key found for this signature in database
GPG Key ID: 173E9B9CA92EEF8F

View File

@ -153,7 +153,7 @@ public class Tailer implements Serializable {
Stack<String> stack = new Stack<>();
long start = this.randomAccessFile.getFilePointer();
long nextEnd = len - 1;
long nextEnd = (len - 1) < 0 ? 0 : len - 1;
this.randomAccessFile.seek(nextEnd);
int c;
int currentLine = 0;