From 936b43bedc07f86d935986c9dc3ff5326262e2e4 Mon Sep 17 00:00:00 2001 From: tnhnblgl <51187395+tnhnblgl@users.noreply.github.com> Date: Tue, 17 Jun 2025 04:35:42 +0300 Subject: [PATCH] Fix: Handle not spawned player focus (#1186) ## Description: Implementing the fix for #1184 ## Please complete the following: - [x] I have added screenshots for all UI updates - [x] I process any text displayed to the user through translateText() and I've added it to the en.json file - [x] I have added relevant tests to the test directory - [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 ## Please put your Discord username so you can be contacted if a bug or regression is found: dovg --- src/client/graphics/TransformHandler.ts | 9 +++++---- 1 file changed, 5 insertions(+), 4 deletions(-) diff --git a/src/client/graphics/TransformHandler.ts b/src/client/graphics/TransformHandler.ts index 7f111a280..40de3fa3e 100644 --- a/src/client/graphics/TransformHandler.ts +++ b/src/client/graphics/TransformHandler.ts @@ -152,10 +152,11 @@ export class TransformHandler { onGoToPlayer(event: GoToPlayerEvent) { this.game.setFocusedPlayer(event.player); this.clearTarget(); - this.target = new Cell( - event.player.nameLocation().x, - event.player.nameLocation().y, - ); + const nameLocation = event.player.nameLocation(); + if (!nameLocation) { + return; + } + this.target = new Cell(nameLocation.x, nameLocation.y); this.intervalID = setInterval(() => this.goTo(), GOTO_INTERVAL_MS); }