From 093b6e4f21b0c174a0503e8e10c0686757e55c79 Mon Sep 17 00:00:00 2001 From: Suha Can Date: Mon, 21 Mar 2011 16:34:49 -0700 Subject: [PATCH] Fixing #17275 --HG-- branch : dev --- .../Core/Containers/Drivers/ContainablePartDriver.cs | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/src/Orchard.Web/Core/Containers/Drivers/ContainablePartDriver.cs b/src/Orchard.Web/Core/Containers/Drivers/ContainablePartDriver.cs index be24ba316..65666c63f 100644 --- a/src/Orchard.Web/Core/Containers/Drivers/ContainablePartDriver.cs +++ b/src/Orchard.Web/Core/Containers/Drivers/ContainablePartDriver.cs @@ -30,7 +30,7 @@ namespace Orchard.Core.Containers.Drivers { var commonPart = part.As(); var model = new ContainableViewModel(); - if (commonPart.Container != null) { + if (commonPart != null && commonPart.Container != null) { model.ContainerId = commonPart.Container.Id; } @@ -38,7 +38,9 @@ namespace Orchard.Core.Containers.Drivers { var oldContainerId = model.ContainerId; updater.TryUpdateModel(model, "Containable", null, null); if (oldContainerId != model.ContainerId) - commonPart.Container = _contentManager.Get(model.ContainerId, VersionOptions.Latest); + if (commonPart != null) { + commonPart.Container = _contentManager.Get(model.ContainerId, VersionOptions.Latest); + } } // note: string.isnullorempty not being recognized by linq-to-nhibernate hence the inline or