diff options
| author | Florian Fischer <florian.fischer@muhq.space> | 2025-08-06 15:36:05 +0200 |
|---|---|---|
| committer | Florian Fischer <florian.fischer@muhq.space> | 2025-08-20 15:57:34 +0200 |
| commit | 486e240975682bef87d8a1d60fa80e3b1ee41b32 (patch) | |
| tree | bc367d456f291e0d5498129cf759f8d527031ce2 | |
| parent | 5e701d3d23c1e35c4b20c79d5ed9b649aa1dea43 (diff) | |
| download | muhqs-game-486e240975682bef87d8a1d60fa80e3b1ee41b32.tar.gz muhqs-game-486e240975682bef87d8a1d60fa80e3b1ee41b32.zip | |
prevent choice index out of bounds errors
This can happen if the last x coordinate of a choice is clicked.
| -rw-r--r-- | go/ui/choice.go | 1 |
1 files changed, 1 insertions, 0 deletions
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 } |
