From 70597470c50528e458f5121da215cce3fb37148b Mon Sep 17 00:00:00 2001
From: VariableVince <24507472+VariableVince@users.noreply.github.com>
Date: Mon, 3 Nov 2025 21:48:20 +0100
Subject: [PATCH] Fix empty Leaderboard on Teams replay (#2370)
## Description:
Fixes https://github.com/openfrontio/OpenFrontIO/issues/2356
Leaderboard was empty on replay of Team games. This fixes it.
For v26, since the bug was introduced in v26. Set main as target branch
though.
**BEFORE**
**AFTER**
## 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
## Please put your Discord username so you can be contacted if a bug or
regression is found:
tryout33
---
src/client/graphics/layers/Leaderboard.ts | 4 +++-
1 file changed, 3 insertions(+), 1 deletion(-)
diff --git a/src/client/graphics/layers/Leaderboard.ts b/src/client/graphics/layers/Leaderboard.ts
index 8d6a32d6e..21aee6e32 100644
--- a/src/client/graphics/layers/Leaderboard.ts
+++ b/src/client/graphics/layers/Leaderboard.ts
@@ -116,7 +116,9 @@ export class Leaderboard extends LitElement implements Layer {
gold: renderNumber(player.gold()),
troops: renderNumber(troops),
isMyPlayer: player === myPlayer,
- isOnSameTeam: player === myPlayer || player.isOnSameTeam(myPlayer!),
+ isOnSameTeam:
+ myPlayer !== null &&
+ (player === myPlayer || player.isOnSameTeam(myPlayer)),
player: player,
};
});