aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorCody Robibero <cody@robibe.ro>2021-11-19 05:07:54 -0700
committerGitHub <noreply@github.com>2021-11-19 05:07:54 -0700
commit4a7498a0be5a48d39dbe3dc4395dd9a6c0ffe057 (patch)
tree65308f4bf840a719eb9f2751af363ed259368551
parentfa366f0099eb598c311cc1b84aad504584d390f0 (diff)
parente3f0a53f59830e9af7e4ab6dbe6356b9824a6624 (diff)
Merge pull request #6869 from cvium/optimize_childcount
Small optimization to child count field
-rw-r--r--Emby.Server.Implementations/Dto/DtoService.cs6
1 files changed, 6 insertions, 0 deletions
diff --git a/Emby.Server.Implementations/Dto/DtoService.cs b/Emby.Server.Implementations/Dto/DtoService.cs
index 67ecd04e0..b91ff6408 100644
--- a/Emby.Server.Implementations/Dto/DtoService.cs
+++ b/Emby.Server.Implementations/Dto/DtoService.cs
@@ -370,6 +370,12 @@ namespace Emby.Server.Implementations.Dto
if (item is MusicAlbum || item is Season || item is Playlist)
{
dto.ChildCount = dto.RecursiveItemCount;
+ var folderChildCount = folder.LinkedChildren.Length;
+ // The default is an empty array, so we can't reliably use the count when it's empty
+ if (folderChildCount > 0)
+ {
+ dto.ChildCount ??= folderChildCount;
+ }
}
if (options.ContainsField(ItemFields.ChildCount))