From 72b08f4029e8dfa5ea8dfb0b2cb69e32d9d032a6 Mon Sep 17 00:00:00 2001 From: Shannon Date: Tue, 12 Nov 2013 13:28:13 +1100 Subject: [PATCH] Fixes an issue if the upgrade check server is not responding. --- .../Editors/UpdateCheckController.cs | 24 +++++++++++++------ 1 file changed, 17 insertions(+), 7 deletions(-) diff --git a/src/Umbraco.Web/Editors/UpdateCheckController.cs b/src/Umbraco.Web/Editors/UpdateCheckController.cs index 57c20e2574..aa4966b14c 100644 --- a/src/Umbraco.Web/Editors/UpdateCheckController.cs +++ b/src/Umbraco.Web/Editors/UpdateCheckController.cs @@ -20,13 +20,21 @@ namespace Umbraco.Web.Editors var updateCheckCookie = updChkCookie != null ? updChkCookie["UMB_UPDCHK"].Value : ""; if (GlobalSettings.VersionCheckPeriod > 0 && string.IsNullOrEmpty(updateCheckCookie) && Security.CurrentUser.UserType.Alias == "admin") { - var check = new global::umbraco.presentation.org.umbraco.update.CheckForUpgrade(); - var result = check.CheckUpgrade(UmbracoVersion.Current.Major, - UmbracoVersion.Current.Minor, - UmbracoVersion.Current.Build, - UmbracoVersion.CurrentComment); - - return new UpgradeCheckResponse(result.UpgradeType.ToString(), result.Comment, result.UpgradeUrl); + try + { + var check = new global::umbraco.presentation.org.umbraco.update.CheckForUpgrade(); + var result = check.CheckUpgrade(UmbracoVersion.Current.Major, + UmbracoVersion.Current.Minor, + UmbracoVersion.Current.Build, + UmbracoVersion.CurrentComment); + + return new UpgradeCheckResponse(result.UpgradeType.ToString(), result.Comment, result.UpgradeUrl); + } + catch (System.Net.WebException) + { + //this occurs if the server is down or cannot be reached + return null; + } } return null; } @@ -41,6 +49,8 @@ namespace Umbraco.Web.Editors { public override void OnActionExecuted(HttpActionExecutedContext context) { + if (context.Response == null) return; + var objectContent = context.Response.Content as ObjectContent; if (objectContent == null || objectContent.Value == null) return;