Ensure we never return a null string from LookupCountry.
This commit is contained in:
@@ -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;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user