Skip to content

Commit 99684a6

Browse files
committed
fix: panic when len(lines) is fewer than max_line
1 parent 8b97bcc commit 99684a6

1 file changed

Lines changed: 3 additions & 0 deletions

File tree

pkg/logs/show.go

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -171,5 +171,8 @@ func readNLines(file *os.File) string {
171171
if initial < 0 {
172172
initial = 0
173173
}
174+
if final >= len(lines) {
175+
final = len(lines) - 1
176+
}
174177
return strings.Join(lines[initial:final], "\n")
175178
}

0 commit comments

Comments
 (0)