Skip to content

Commit

Permalink
Merge pull request mikeedwards83#468 from robmaas/feature/sc104-fix
Browse files Browse the repository at this point in the history
Fix Sitecore 10.4 on Castle.Core 5+
  • Loading branch information
muso31 authored Jul 26, 2024
2 parents 3c313f5 + 701371f commit 92faae0
Showing 1 changed file with 3 additions and 2 deletions.
5 changes: 3 additions & 2 deletions Source/Glass.Mapper.Sc/SitecoreVersionAbstractions.cs
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,6 @@
using Sitecore.Data.Items;
using Sitecore.Links;
using Sitecore.Resources.Media;
using Castle.Core.Internal;

namespace Glass.Mapper.Sc
{
Expand All @@ -36,7 +35,9 @@ public static string GetMediaUrl(MediaItem media)
public static string GetItemUrl(Item item, UrlOptions urlOptions)
{
#if SC104
if (item?.Paths == null || item.Paths.GetPathParts(urlOptions?.UseDisplayName == true ? ItemPathType.DisplayName : ItemPathType.Name).IsNullOrEmpty())
if (item?.Paths == null) return string.Empty;
var paths = item.Paths.GetPathParts(urlOptions?.UseDisplayName == true ? ItemPathType.DisplayName : ItemPathType.Name);
if (paths == null || paths.Length == 0)
{
return string.Empty;
}
Expand Down

0 comments on commit 92faae0

Please sign in to comment.