diff --git a/src/Umbraco.Web/umbraco.presentation/umbraco/dialogs/treePicker.aspx.cs b/src/Umbraco.Web/umbraco.presentation/umbraco/dialogs/treePicker.aspx.cs index 38518804b4..30f9fbb12d 100644 --- a/src/Umbraco.Web/umbraco.presentation/umbraco/dialogs/treePicker.aspx.cs +++ b/src/Umbraco.Web/umbraco.presentation/umbraco/dialogs/treePicker.aspx.cs @@ -21,10 +21,14 @@ namespace umbraco.dialogs TreeParams = TreeRequestParams.FromQueryStrings().CreateTreeService(); DataBind(); - if(Request.QueryString["selected"] != null && TreeParams.TreeType == "content") { + if(Request.QueryString["selected"] != null && TreeParams.TreeType == "content") + { var currContent = Services.ContentService.GetById(int.Parse(Request.QueryString["selected"])); - if (currContent.ParentId > 0) - DialogTree.SelectedNodePath = currContent.Path; + if (currContent != null) + { + if (currContent.ParentId > 0) + DialogTree.SelectedNodePath = currContent.Path; + } } } diff --git a/src/umbraco.controls/TreePicker/SimpleContentPicker.cs b/src/umbraco.controls/TreePicker/SimpleContentPicker.cs index 21adda53a6..82838b11dc 100644 --- a/src/umbraco.controls/TreePicker/SimpleContentPicker.cs +++ b/src/umbraco.controls/TreePicker/SimpleContentPicker.cs @@ -13,9 +13,9 @@ namespace umbraco.uicontrols.TreePicker { get { - if (HttpContext.Current != null && HttpContext.Current.Request.QueryString["id"] != null) + if ( Context.Request.QueryString["id"] != null) { - return TreeUrlGenerator.GetPickerUrl(Constants.Applications.Content, "content") + "&selected=" + HttpContext.Current.Request.QueryString["id"]; + return TreeUrlGenerator.GetPickerUrl(Constants.Applications.Content, "content") + "&selected=" + Context.Request.QueryString["id"]; } diff --git a/src/umbraco.editorControls/pagepicker/pagePicker.cs b/src/umbraco.editorControls/pagepicker/pagePicker.cs index 932fe4fb40..22074d11fc 100644 --- a/src/umbraco.editorControls/pagepicker/pagePicker.cs +++ b/src/umbraco.editorControls/pagepicker/pagePicker.cs @@ -22,15 +22,15 @@ namespace umbraco.editorControls { public pagePicker() : base() { } - public pagePicker(interfaces.IData data) : base(data) { } + public pagePicker(IData data) : base(data) { } public override string TreePickerUrl { get { - if (HttpContext.Current != null && HttpContext.Current.Request.QueryString["id"] != null) + if (Context.Request.QueryString["id"] != null) { - return TreeUrlGenerator.GetPickerUrl(Umbraco.Core.Constants.Applications.Content, "content") + "&selected=" + HttpContext.Current.Request.QueryString["id"]; + return TreeUrlGenerator.GetPickerUrl(Umbraco.Core.Constants.Applications.Content, "content") + "&selected=" + Context.Request.QueryString["id"]; } return TreeUrlGenerator.GetPickerUrl(Umbraco.Core.Constants.Applications.Content, "content");