From af5a3a51dee0c40a1dacd7822c0c56f96cc5a4e6 Mon Sep 17 00:00:00 2001 From: Dan Cojocaru Date: Tue, 26 Dec 2023 06:30:01 +0100 Subject: [PATCH] Fix OOB bug for trains with multiple groups --- pkg/handlers/findTrain.go | 3 +++ 1 file changed, 3 insertions(+) diff --git a/pkg/handlers/findTrain.go b/pkg/handlers/findTrain.go index 9ee5688..71f7dae 100644 --- a/pkg/handlers/findTrain.go +++ b/pkg/handlers/findTrain.go @@ -75,6 +75,9 @@ func HandleTrainNumberCommand(ctx context.Context, trainNumber string, date time } shouldUnsubscribe := func() bool { + if groupIndex == -1 { + return false + } if len(trainData.Groups) <= groupIndex { groupIndex = 0 }