Preventing TimeZone from crashing if the migration cannot run before using it

--HG--
branch : 1.x
This commit is contained in:
Sebastien Ros
2012-01-12 18:31:40 -08:00
parent fc99676fe0
commit d61e98e010
+7
View File
@@ -13,11 +13,18 @@ namespace Orchard.Time {
} }
public TimeZoneSelectorResult GetTimeZone(HttpContextBase context) { public TimeZoneSelectorResult GetTimeZone(HttpContextBase context) {
try {
var siteTimeZoneId = _workContextAccessor.GetContext(context).CurrentSite.SiteTimeZone; var siteTimeZoneId = _workContextAccessor.GetContext(context).CurrentSite.SiteTimeZone;
if (String.IsNullOrEmpty(siteTimeZoneId)) { if (String.IsNullOrEmpty(siteTimeZoneId)) {
return null; return null;
} }
}
catch {
// if the database could not be updated in time, ignore this provider
return null;
}
return new TimeZoneSelectorResult { return new TimeZoneSelectorResult {
Priority = -5, Priority = -5,