Fixing the ChooseWidget layer retrieval.

--HG--
branch : dev
This commit is contained in:
Nathan Heskew
2011-03-24 11:27:26 -07:00
parent 08af158b75
commit 5f18d79cf7

View File

@@ -113,11 +113,8 @@ namespace Orchard.Widgets.Controllers {
return RedirectToAction("Index");
}
LayerPart currentLayer = layerId == null
? layers.First()
: layers.FirstOrDefault(layer => layer.Id == layerId);
if (currentLayer == null && layerId != null) { // Incorrect layer id passed
LayerPart currentLayer = layers.FirstOrDefault(layer => layer.Id == layerId);
if (currentLayer == null) { // Incorrect layer id passed
Services.Notifier.Error(T("Layer not found: {0}", layerId));
return RedirectToAction("Index");
}