From c0dd7c3182f79b2c35fefd7c347b1f402de547e2 Mon Sep 17 00:00:00 2001 From: Oliver Brakmann Date: Sun, 5 Jun 2016 12:55:00 +0200 Subject: [PATCH] Fix NREs in LobbyUtils.GetExternalIP --- OpenRA.Mods.Common/Widgets/Logic/Lobby/LobbyUtils.cs | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/OpenRA.Mods.Common/Widgets/Logic/Lobby/LobbyUtils.cs b/OpenRA.Mods.Common/Widgets/Logic/Lobby/LobbyUtils.cs index f33f5f855f..a4a520392a 100644 --- a/OpenRA.Mods.Common/Widgets/Logic/Lobby/LobbyUtils.cs +++ b/OpenRA.Mods.Common/Widgets/Logic/Lobby/LobbyUtils.cs @@ -504,8 +504,10 @@ namespace OpenRA.Mods.Common.Widgets.Logic public static string GetExternalIP(int clientIndex, OrderManager orderManager) { - var address = orderManager.LobbyInfo.ClientWithIndex(clientIndex).IpAddress; - if (clientIndex == orderManager.LocalClient.Index && address == IPAddress.Loopback.ToString()) + var client = orderManager.LobbyInfo.ClientWithIndex(clientIndex); + var address = client != null ? client.IpAddress : ""; + var lc = orderManager.LocalClient; + if (lc != null && lc.Index == clientIndex && address == IPAddress.Loopback.ToString()) { var externalIP = UPnP.GetExternalIP(); if (externalIP != null)