Fixing potential NRE in LocalizationPartHandler by adding a nullcheck in LocalizationPartDriver

This commit is contained in:
Lombiq
2015-07-12 19:35:52 +02:00
committed by Benedek Farkas
parent 6fe3cf8538
commit e74b6ad6f8

View File

@@ -60,7 +60,9 @@ namespace Orchard.Localization.Drivers {
protected override DriverResult Editor(LocalizationPart part, IUpdateModel updater, dynamic shapeHelper) {
var model = new EditLocalizationViewModel();
if (updater != null && updater.TryUpdateModel(model, TemplatePrefix, null, null)) {
// Content culture has to be set only if it's not set already.
if (updater != null && updater.TryUpdateModel(model, TemplatePrefix, null, null) && GetCulture(part) == null) {
_localizationService.SetContentCulture(part, model.SelectedCulture);
}