Don't create multiple instances of the same type

This commit is contained in:
Bond_009 2019-02-06 17:41:38 +01:00 committed by Bond-009
parent 9af28607c9
commit d409623086

View File

@ -512,7 +512,8 @@ namespace Emby.Server.Implementations
var parts = GetExportTypes<T>() var parts = GetExportTypes<T>()
.Select(x => CreateInstanceSafe(x)) .Select(x => CreateInstanceSafe(x))
.Where(i => i != null) .Where(i => i != null)
.Cast<T>(); .Cast<T>()
.ToList(); // Convert to list so this isn't executed for each iteration
if (manageLifetime) if (manageLifetime)
{ {