Fix several NREs during setup of client tooltips in GameInfoStatsLogic

This commit is contained in:
Oliver Brakmann
2016-04-09 15:21:17 +02:00
parent b49f1439ed
commit fe02bea521
2 changed files with 5 additions and 4 deletions

View File

@@ -67,7 +67,7 @@ namespace OpenRA.Mods.Common.Widgets.Logic
var pp = p;
var client = world.LobbyInfo.ClientWithIndex(pp.ClientIndex);
var item = playerTemplate.Clone();
LobbyUtils.SetupClientWidget(item, client, orderManager, client.Bot == null);
LobbyUtils.SetupClientWidget(item, client, orderManager, client != null && client.Bot == null);
var nameLabel = item.Get<LabelWidget>("NAME");
var nameFont = Game.Renderer.Fonts[nameLabel.Font];

View File

@@ -240,7 +240,7 @@ namespace OpenRA.Mods.Common.Widgets.Logic
{
var adminIndicator = parent.GetOrNull("ADMIN_INDICATOR");
if (adminIndicator != null)
adminIndicator.IsVisible = () => c.IsAdmin;
adminIndicator.IsVisible = () => c != null && c.IsAdmin;
var block = parent.GetOrNull("LATENCY");
if (block != null)
@@ -253,7 +253,8 @@ namespace OpenRA.Mods.Common.Widgets.Logic
}
var tooltip = parent.Get<ClientTooltipRegionWidget>("CLIENT_REGION");
tooltip.IsVisible = () => visible;
tooltip.IsVisible = () => c != null && visible;
if (c != null)
tooltip.Bind(orderManager, c.Index);
}