Fixed possible issue with integer parsing.
This commit is contained in:
parent
6709102756
commit
c94d37d7c7
1 changed files with 10 additions and 5 deletions
|
@ -48,9 +48,11 @@ namespace ScrewTurn.Wiki {
|
||||||
HttpCookie cookie = HttpContext.Current.Request.Cookies[Settings.CultureCookieName];
|
HttpCookie cookie = HttpContext.Current.Request.Cookies[Settings.CultureCookieName];
|
||||||
if(cookie != null) {
|
if(cookie != null) {
|
||||||
string timezone = cookie["T"];
|
string timezone = cookie["T"];
|
||||||
return int.Parse(timezone, CultureInfo.InvariantCulture);
|
int res = 0;
|
||||||
|
if(int.TryParse(timezone, NumberStyles.Any, CultureInfo.InvariantCulture, out res)) return res;
|
||||||
}
|
}
|
||||||
else return null;
|
|
||||||
|
return null;
|
||||||
}
|
}
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
|
@ -61,10 +63,13 @@ namespace ScrewTurn.Wiki {
|
||||||
UserInfo currentUser = SessionFacade.GetCurrentUser();
|
UserInfo currentUser = SessionFacade.GetCurrentUser();
|
||||||
if(currentUser != null) {
|
if(currentUser != null) {
|
||||||
string timezone = Users.GetUserData(currentUser, "Timezone");
|
string timezone = Users.GetUserData(currentUser, "Timezone");
|
||||||
if(timezone != null) return int.Parse(timezone, CultureInfo.InvariantCulture);
|
if(timezone != null) {
|
||||||
else return null;
|
int res = 0;
|
||||||
|
if(int.TryParse(timezone, NumberStyles.Any, CultureInfo.InvariantCulture, out res)) return res;
|
||||||
}
|
}
|
||||||
else return null;
|
}
|
||||||
|
|
||||||
|
return null;
|
||||||
}
|
}
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue