diff options
| author | JPVenson <github@jpb.email> | 2025-09-12 21:58:16 +0200 |
|---|---|---|
| committer | GitHub <noreply@github.com> | 2025-09-12 13:58:16 -0600 |
| commit | c02a24e32a7c4ffc4f00620d53911d044b26c9cc (patch) | |
| tree | c821c817a56b4718f6fce4759513dc979d15754e /MediaBrowser.Controller/Entities/BaseItem.cs | |
| parent | deee04ae38cf057938f37c1dd7a98d20cf5b65f3 (diff) | |
Fix several Stackoverflows (#14783)
Diffstat (limited to 'MediaBrowser.Controller/Entities/BaseItem.cs')
| -rw-r--r-- | MediaBrowser.Controller/Entities/BaseItem.cs | 34 |
1 files changed, 21 insertions, 13 deletions
diff --git a/MediaBrowser.Controller/Entities/BaseItem.cs b/MediaBrowser.Controller/Entities/BaseItem.cs index bb0b26b8e..275fdac2e 100644 --- a/MediaBrowser.Controller/Entities/BaseItem.cs +++ b/MediaBrowser.Controller/Entities/BaseItem.cs @@ -701,19 +701,7 @@ namespace MediaBrowser.Controller.Entities { get { - var customRating = CustomRating; - if (!string.IsNullOrEmpty(customRating)) - { - return customRating; - } - - var parent = DisplayParent; - if (parent is not null) - { - return parent.CustomRatingForComparison; - } - - return null; + return GetCustomRatingForComparision(); } } @@ -791,6 +779,26 @@ namespace MediaBrowser.Controller.Entities /// <value>The remote trailers.</value> public IReadOnlyList<MediaUrl> RemoteTrailers { get; set; } + private string GetCustomRatingForComparision(HashSet<Guid> callstack = null) + { + callstack ??= new(); + var customRating = CustomRating; + if (!string.IsNullOrEmpty(customRating)) + { + return customRating; + } + + callstack.Add(Id); + + var parent = DisplayParent; + if (parent is not null && !callstack.Contains(parent.Id)) + { + return parent.GetCustomRatingForComparision(callstack); + } + + return null; + } + public virtual double GetDefaultPrimaryImageAspectRatio() { return 0; |
