Ensure we never return a null string from LookupCountry.

This commit is contained in:
RoosterDragon
2015-04-28 20:51:41 +01:00
parent ccf9d8fe97
commit 748b37ede7

View File

@@ -237,14 +237,16 @@ namespace OpenRA.Mods.Common.Widgets.Logic
public static string LookupCountry(string ip)
{
const string Unknown = "Unknown Location";
try
{
return Game.GeoIpDatabase.Country(ip).Country.Name;
return Game.GeoIpDatabase.Country(ip).Country.Name ?? Unknown;
}
catch (Exception e)
{
Log.Write("geoip", "LookupCountry failed: {0}", e);
return "Unknown Location";
return Unknown;
}
}