Skip to content

Commit

Permalink
fixed #50 geolocation service should no longer throw an exception on …
Browse files Browse the repository at this point in the history
…the register page
  • Loading branch information
w8tcha committed Dec 28, 2013
1 parent 215948a commit 9b9a9d6
Showing 1 changed file with 8 additions and 4 deletions.
12 changes: 8 additions & 4 deletions yafsrc/YetAnotherForum.NET/pages/register.ascx.cs
Expand Up @@ -940,15 +940,19 @@ private void FillLocationData([NotNull]DropDownList country, [NotNull]DropDownLi

var location = new StringBuilder();

if (this._UserIpLocator["CountryName"] != null && this._UserIpLocator["CountryName"].IsSet() && !this._UserIpLocator["CountryName"].Equals("-"))
if (this._UserIpLocator["CountryCode"] != null && this._UserIpLocator["CountryCode"].IsSet() && !this._UserIpLocator["CountryCode"].Equals("-"))
{
country.Items.FindByValue(this.Get<ILocalization>().Culture.Name.Substring(2, 2)).Selected =
true;
var countryItem = country.Items.FindByValue(this._UserIpLocator["CountryCode"]);

if (countryItem != null)
{
countryItem.Selected = true;
}
}

if (this._UserIpLocator["RegionName"] != null && this._UserIpLocator["RegionName"].IsSet() && !this._UserIpLocator["RegionName"].Equals("-"))
{
location.AppendFormat(", {0}", this._UserIpLocator["RegionName"]);
location.Append(this._UserIpLocator["RegionName"]);
}

if (this._UserIpLocator["CityName"] != null && this._UserIpLocator["CityName"].IsSet() && !this._UserIpLocator["CityName"].Equals("-"))
Expand Down

0 comments on commit 9b9a9d6

Please sign in to comment.