Преглед на файлове

Remove unnecessary array allocation

Co-authored-by: Claus Vium <cvium@users.noreply.github.com>
Dmitry Lyzo преди 3 години
родител
ревизия
54549cd5b5
променени са 1 файла, в които са добавени 1 реда и са изтрити 2 реда
  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);
                 }
             }