mirror of https://github.com/ppy/osu
Avoid crashing if a skin component cannot be instantiated correctly
This commit is contained in:
parent
4d91f403d8
commit
a0a3bba46e
|
@ -144,9 +144,23 @@ public virtual Drawable GetDrawableComponent(ISkinComponent component)
|
|||
if (!DrawableComponentInfo.TryGetValue(target.Target, out var skinnableInfo))
|
||||
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
|
||||
{
|
||||
ChildrenEnumerable = skinnableInfo.Select(i => i.CreateInstance())
|
||||
Children = components,
|
||||
};
|
||||
}
|
||||
|
||||
|
|
Loading…
Reference in New Issue