Updates an error msg for media resource, performs a null check

This commit is contained in:
Shannon
2014-04-24 11:58:18 +10:00
parent e8989de82e
commit c6e3340be1
3 changed files with 8 additions and 4 deletions

View File

@@ -34,7 +34,7 @@ function mediaTypeResource($q, $http, umbRequestHelper) {
"mediaTypeApiBaseUrl",
"GetAllowedChildren",
[{ contentId: mediaId }])),
'Failed to retrieve data for media id ' + mediaId);
'Failed to retrieve allowed types for media id ' + mediaId);
}
};

View File

@@ -154,9 +154,11 @@ namespace Umbraco.Web.Editors
/// </remarks>
protected TPersisted GetObjectFromRequest<TPersisted>(Func<TPersisted> getFromService)
{
return Request.Properties.ContainsKey(typeof (TPersisted).ToString()) == false
? getFromService()
: (TPersisted) Request.Properties[typeof (TPersisted).ToString()];
//checks if the request contains the key and the item is not null, if that is the case, return it from the request, otherwise return
// it from the callback
return Request.Properties.ContainsKey(typeof(TPersisted).ToString()) && Request.Properties[typeof(TPersisted).ToString()] != null
? (TPersisted) Request.Properties[typeof (TPersisted).ToString()]
: getFromService();
}
/// <summary>

View File

@@ -96,6 +96,8 @@ namespace Umbraco.Web.Editors
if (foundContent == null)
{
HandleContentNotFound(id);
//HandleContentNotFound will throw an exception
return null;
}
return Mapper.Map<IMedia, MediaItemDisplay>(foundContent);
}