1
0
mirror of https://github.com/ppy/osu.git synced 2025-01-12 17:23:22 +08:00

Avoid crashing if a skin component cannot be instantiated correctly

This commit is contained in:
Dean Herbert 2022-03-25 18:31:23 +09:00
parent 4d91f403d8
commit a0a3bba46e

View File

@ -144,9 +144,23 @@ namespace osu.Game.Skinning
if (!DrawableComponentInfo.TryGetValue(target.Target, out var skinnableInfo)) if (!DrawableComponentInfo.TryGetValue(target.Target, out var skinnableInfo))
return null; return null;
var components = new List<Drawable>();
foreach (var i in skinnableInfo)
{
try
{
components.Add(i.CreateInstance());
}
catch (Exception e)
{
Logger.Error(e, $"Unable to create skin component {i.Type.Name}");
}
}
return new SkinnableTargetComponentsContainer return new SkinnableTargetComponentsContainer
{ {
ChildrenEnumerable = skinnableInfo.Select(i => i.CreateInstance()) Children = components,
}; };
} }