Skip to content

Commit

Permalink
fix: add interface conversion pre-check
Browse files Browse the repository at this point in the history
  • Loading branch information
gitsang committed Jul 3, 2024
1 parent 8c90f79 commit e5a095b
Showing 1 changed file with 3 additions and 1 deletion.
4 changes: 3 additions & 1 deletion exporter/streams.go
Original file line number Diff line number Diff line change
Expand Up @@ -75,7 +75,9 @@ func getStreamInfo(c redis.Conn, key string) (*streamInfo, error) {
}

func getStreamEntryId(redisValue []interface{}, index int) string {
if len(redisValue) < index || redisValue[index] == nil || len(redisValue[index].([]interface{})) < 2 {
if _, ok := redisValue[index].([]interface{}); !ok ||
len(redisValue) < index || redisValue[index] == nil ||
len(redisValue[index].([]interface{})) < 2 {
log.Debugf("Failed to parse StreamEntryId")
return ""
}
Expand Down

0 comments on commit e5a095b

Please sign in to comment.