Browse Source

Remove unnecessary array allocation

Co-authored-by: Claus Vium <cvium@users.noreply.github.com>
Dmitry Lyzo 3 years ago
parent
commit
54549cd5b5
1 changed files with 1 additions and 2 deletions
  1. 1 2
      Emby.Server.Implementations/Dto/DtoService.cs

+ 1 - 2
Emby.Server.Implementations/Dto/DtoService.cs

@@ -1108,8 +1108,7 @@ namespace Emby.Server.Implementations.Dto
                 }
                 else
                 {
-                    allExtras ??= item.GetExtras().ToArray();
-                    dto.LocalTrailerCount = allExtras.Count(i => i.ExtraType == ExtraType.Trailer);
+                    dto.LocalTrailerCount = (allExtras ?? item.GetExtras()).Count(i => i.ExtraType == ExtraType.Trailer);
                 }
             }