Skip to content

Commit

Permalink
fix out of range panic when loading logs from memory only
Browse files Browse the repository at this point in the history
  • Loading branch information
pk910 committed Oct 2, 2024
1 parent fd33eed commit 3ce6f4a
Showing 1 changed file with 1 addition and 1 deletion.
2 changes: 1 addition & 1 deletion pkg/coordinator/logger/dbwriter.go
Original file line number Diff line number Diff line change
Expand Up @@ -180,7 +180,7 @@ func (lh *logDBWriter) GetLogEntries(from, limit int) []*db.TaskLog {
return dbEntries
}

if dbEntries[len(dbEntries)-1].LogIndex >= bufEntries[0].LogIndex {
if len(dbEntries) > 0 && dbEntries[len(dbEntries)-1].LogIndex >= bufEntries[0].LogIndex {
// remove overlapping entries
bufEntries = bufEntries[dbEntries[len(dbEntries)-1].LogIndex-bufEntries[0].LogIndex+1:]
}
Expand Down

0 comments on commit 3ce6f4a

Please sign in to comment.