fix BaseRest config management - would throw when missing config files
This commit is contained in:
@@ -88,6 +88,9 @@ namespace Umbraco.Web.BaseRest
|
||||
|
||||
var config = (Configuration.BaseRestSection)System.Configuration.ConfigurationManager.GetSection("BaseRestExtensions");
|
||||
|
||||
if (config == null)
|
||||
return null; // does not exist
|
||||
|
||||
// fixme - at the moment we reload the config file each time
|
||||
// we have to support live edits of the config file for backward compatibility reason
|
||||
// so if we want to cache, we'd also need to implement a watcher on the config file...
|
||||
@@ -111,6 +114,9 @@ namespace Umbraco.Web.BaseRest
|
||||
string typeName = eNode.Attributes["type"].Value;
|
||||
Type type = assembly.GetType(typeName);
|
||||
|
||||
if (type == null)
|
||||
return null; // does not exist
|
||||
|
||||
var method = type.GetMethod(methodName);
|
||||
|
||||
if (method == null)
|
||||
@@ -135,6 +141,9 @@ namespace Umbraco.Web.BaseRest
|
||||
{
|
||||
var config = (Configuration.BaseRestSection)System.Configuration.ConfigurationManager.GetSection("BaseRestExtensions");
|
||||
|
||||
if (config == null)
|
||||
return null; // does not exist
|
||||
|
||||
Configuration.ExtensionElement configExtension = config.Items[extensionAlias];
|
||||
if (configExtension == null)
|
||||
return null; // does not exist
|
||||
|
||||
Reference in New Issue
Block a user