diff options
| author | Florian Fischer <florian.fischer@muhq.space> | 2023-01-20 03:25:14 +0100 |
|---|---|---|
| committer | Florian Fischer <florian.fischer@muhq.space> | 2025-01-27 16:43:44 +0100 |
| commit | 104300e058b2406e55367d6b05425428cda15115 (patch) | |
| tree | 58b131b519eb88e78d8bcf93c8659b80840c6542 /go | |
| parent | c4cb9637f5c85d03aa162968f0dfec3c193fc9dc (diff) | |
| download | muhqs-game-104300e058b2406e55367d6b05425428cda15115.tar.gz muhqs-game-104300e058b2406e55367d6b05425428cda15115.zip | |
sanity check calculated x and y before using it as slice index
Diffstat (limited to 'go')
| -rw-r--r-- | go/ui/mapView.go | 4 |
1 files changed, 4 insertions, 0 deletions
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 |
