Permalink
Browse files

Added null checks

  • Loading branch information...
1 parent dfb4b84 commit e0c9eddd97895426e95d60c1569b90c6530a7ed4 @jchannon jchannon committed Dec 21, 2012
Showing with 7 additions and 2 deletions.
  1. +7 −2 src/Nancy/ViewEngines/DefaultTextResource.cs
@@ -15,14 +15,19 @@ public DefaultTextResource()
var assemblies = AppDomain.CurrentDomain.GetAssemblies();
culturedAssembly = assemblies.FirstOrDefault(x => x.GetManifestResourceNames().Any(y => y.Contains("Text.")));
-
- resourceManager = new ResourceManager(culturedAssembly.GetName().Name + ".Resources.Text", culturedAssembly);
+ if (culturedAssembly != null)
+ {
+ resourceManager = new ResourceManager(culturedAssembly.GetName().Name + ".Resources.Text",
+ culturedAssembly);
+ }
}
public string this[string key, NancyContext context]
{
get
{
+ if (resourceManager == null)
+ return null;
return resourceManager.GetString(key, context.Culture);
}

0 comments on commit e0c9edd

Please sign in to comment.