From 486e240975682bef87d8a1d60fa80e3b1ee41b32 Mon Sep 17 00:00:00 2001 From: Florian Fischer Date: Wed, 6 Aug 2025 15:36:05 +0200 Subject: prevent choice index out of bounds errors This can happen if the last x coordinate of a choice is clicked. --- go/ui/choice.go | 1 + 1 file changed, 1 insertion(+) (limited to 'go') diff --git a/go/ui/choice.go b/go/ui/choice.go index 1c1c72b6..f937646b 100644 --- a/go/ui/choice.go +++ b/go/ui/choice.go @@ -40,6 +40,7 @@ func (c *Choice) setText() { func (c *Choice) GetChoosen(x, y int) int { i := (y - c.Y) / (c.Height / len(c.choices)) + if i == len(c.choices) { i = i - 1 } return i } -- cgit v1.2.3