Skip to content

Commit

Permalink
Fixing NRE when area is not set
Browse files Browse the repository at this point in the history
  • Loading branch information
sebastienros committed Oct 3, 2017
1 parent 6bfd95b commit e54c931
Show file tree
Hide file tree
Showing 2 changed files with 10 additions and 6 deletions.
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
using System;
using System.Collections.Generic;
using System.Linq;
using Microsoft.AspNetCore.Mvc.Razor;
Expand Down Expand Up @@ -84,13 +85,16 @@ IEnumerable<string> PageViewLocations()

var result = new List<string>();

foreach (var theme in currentThemeAndBaseThemesOrdered)
if (!String.IsNullOrEmpty(context.AreaName))
{
if (context.AreaName != theme.Id)
foreach (var theme in currentThemeAndBaseThemesOrdered)
{
var themeViewsPath = '/' + theme.Extension.SubPath + "/Views/" + context.AreaName;
result.Add(themeViewsPath + "/{1}/{0}" + RazorViewEngine.ViewExtension);
result.Add(themeViewsPath + "/Shared/{0}" + RazorViewEngine.ViewExtension);
if (context.AreaName != theme.Id)
{
var themeViewsPath = '/' + theme.Extension.SubPath + "/Views/" + context.AreaName;
result.Add(themeViewsPath + "/{1}/{0}" + RazorViewEngine.ViewExtension);
result.Add(themeViewsPath + "/Shared/{0}" + RazorViewEngine.ViewExtension);
}
}
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -93,7 +93,7 @@ public IExtensionInfo GetExtension(string extensionId)
EnsureInitialized();

ExtensionEntry extension;
if (_extensions.TryGetValue(extensionId, out extension))
if (!String.IsNullOrEmpty(extensionId) && _extensions.TryGetValue(extensionId, out extension))
{
return extension.ExtensionInfo;
}
Expand Down

0 comments on commit e54c931

Please sign in to comment.