From 0c098e74f1dcad27ee26af81d82f2d908c17cd5c Mon Sep 17 00:00:00 2001 From: Paul Chote Date: Sat, 25 Aug 2018 20:15:21 +0100 Subject: [PATCH] Don't crash when mousing over a bot as a non-admin. --- .../Widgets/Logic/Lobby/LobbyUtils.cs | 13 ++++++++----- 1 file changed, 8 insertions(+), 5 deletions(-) diff --git a/OpenRA.Mods.Common/Widgets/Logic/Lobby/LobbyUtils.cs b/OpenRA.Mods.Common/Widgets/Logic/Lobby/LobbyUtils.cs index c68ed27165..5878702b5a 100644 --- a/OpenRA.Mods.Common/Widgets/Logic/Lobby/LobbyUtils.cs +++ b/OpenRA.Mods.Common/Widgets/Logic/Lobby/LobbyUtils.cs @@ -316,24 +316,27 @@ namespace OpenRA.Mods.Common.Widgets.Logic public static void SetupProfileWidget(Widget parent, Session.Client c, OrderManager orderManager, WorldRenderer worldRenderer) { + var visible = c != null && c.Bot == null; var profile = parent.GetOrNull("PROFILE"); - if (profile != null && c.Bot == null) + if (profile != null) { var imageName = (c != null && c.IsAdmin ? "admin-" : "player-") + (c.Fingerprint != null ? "registered" : "anonymous"); profile.GetImageName = () => imageName; - profile.IsVisible = () => true; + profile.IsVisible = () => visible; } var profileTooltip = parent.GetOrNull("PROFILE_TOOLTIP"); - if (profileTooltip != null && c.Bot == null) + if (profileTooltip != null) { if (c != null && c.Fingerprint != null) profileTooltip.Template = "REGISTERED_PLAYER_TOOLTIP"; - profileTooltip.Bind(orderManager, worldRenderer, c); - profileTooltip.IsVisible = () => true; + if (visible) + profileTooltip.Bind(orderManager, worldRenderer, c); + + profileTooltip.IsVisible = () => visible; } }