From da862a1ec947c696bce92495e7d10f1cc5bdda76 Mon Sep 17 00:00:00 2001 From: Scott Anderson Date: Wed, 28 May 2025 05:09:15 -0400 Subject: [PATCH] bug: Clicking out of bounds throws uncaught exception (#920) ## Description: Fix invalid tile error when clicking out of bounds. ## Please complete the following: - [x] I have added screenshots for all UI updates - [x] I confirm I have thoroughly tested these changes and take full responsibility for any bugs introduced - [x] I understand that submitting code with bugs that could have been caught through manual testing blocks releases and new features for all contributors Co-authored-by: Scott Anderson <662325+scottanderson@users.noreply.github.com> --- src/client/graphics/layers/StructureLayer.ts | 3 +++ 1 file changed, 3 insertions(+) diff --git a/src/client/graphics/layers/StructureLayer.ts b/src/client/graphics/layers/StructureLayer.ts index ec1ebfb6a..f8ce3db82 100644 --- a/src/client/graphics/layers/StructureLayer.ts +++ b/src/client/graphics/layers/StructureLayer.ts @@ -360,6 +360,9 @@ export class StructureLayer implements Layer { event.x, event.y, ); + if (!this.game.isValidCoord(cell.x, cell.y)) { + return; + } const clickedUnit = this.findStructureUnitAtCell(cell); this.previouslySelected = this.selectedStructureUnit;