From b0625b49ef265ca42df81fcea7fbbd6b4dbf8a5b Mon Sep 17 00:00:00 2001 From: Florian Fischer Date: Fri, 20 Jan 2023 03:25:14 +0100 Subject: sanity check calculated x and y before using it as slice index --- assets/symbols/gear.png | Bin 50696 -> 22330 bytes go/ui/mapView.go | 4 ++++ 2 files changed, 4 insertions(+) diff --git a/assets/symbols/gear.png b/assets/symbols/gear.png index 821d7e84..d675856e 100644 Binary files a/assets/symbols/gear.png and b/assets/symbols/gear.png differ diff --git a/go/ui/mapView.go b/go/ui/mapView.go index c292d526..43ea0f01 100644 --- a/go/ui/mapView.go +++ b/go/ui/mapView.go @@ -173,6 +173,10 @@ func (vw *MapView) FindObjectAt(x_px, y_px int) interface{} { x := x_px / TILE_WIDTH y := y_px / TILE_HEIGHT + if x < 0 || y < 0 { + return nil + } + // TODO: detect if a permanent or the containing tile was selected for _, u := range vw.gameState.Permanents { pos := u.GetTile().Position -- cgit v1.2.3