Updates an error msg for media resource, performs a null check
This commit is contained in:
@@ -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);
|
||||
}
|
||||
|
||||
};
|
||||
|
||||
@@ -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>
|
||||
|
||||
@@ -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);
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user