fix crash when most active IP list cannot be saturated

(This could have been cleaner by first using Min() or something)

fixes #550
This commit is contained in:
Andreas Shimokawa
2026-04-21 11:19:07 +02:00
parent 242c38caf5
commit 28cde84643

View File

@@ -166,6 +166,9 @@ func Serve(ctx *cli.Context) error {
builder := strings.Builder{}
var item kv
for i := uint(0); i < cfg.Server.MostActiveIpCount; i++ {
if i >= uint(len(kvArray)) {
break
}
item = kvArray[i]
builder.WriteString(fmt.Sprintf("\n%s, %d", item.Key, item.Value))
}