Merge pull request #11079 from obrakmann/fix11040-stats-screen-client-tooltip-crash

Fix several NREs during setup of client tooltips in GameInfoStatsLogic
This commit is contained in:
abcdefg30
2016-04-10 12:03:23 +02:00
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,8 +253,9 @@ namespace OpenRA.Mods.Common.Widgets.Logic
}
var tooltip = parent.Get<ClientTooltipRegionWidget>("CLIENT_REGION");
tooltip.IsVisible = () => visible;
tooltip.Bind(orderManager, c.Index);
tooltip.IsVisible = () => c != null && visible;
if (c != null)
tooltip.Bind(orderManager, c.Index);
}
public static void SetupEditableNameWidget(Widget parent, Session.Slot s, Session.Client c, OrderManager orderManager)