Skip to content

Commit 7e2e72b

Browse files
authored
Bug: check len(items) > 0 for getLatestSecond function in metric reader(#121)
1 parent a9e5747 commit 7e2e72b

File tree

1 file changed

+1
-1
lines changed

1 file changed

+1
-1
lines changed

core/log/metric/reader.go

+1-1
Original file line numberDiff line numberDiff line change
@@ -175,7 +175,7 @@ func readLine(bufReader *bufio.Reader) (string, error) {
175175
}
176176

177177
func getLatestSecond(items []*base.MetricItem) uint64 {
178-
if items == nil {
178+
if items == nil || len(items) == 0 {
179179
return 0
180180
}
181181
return items[len(items)-1].Timestamp / 1000

0 commit comments

Comments
 (0)