mirror of
https://github.com/ppy/osu.git
synced 2024-12-15 12:42:54 +08:00
Merge pull request #17448 from peppy/fix-skin-component-crash-on-instantiation-failure
Avoid crashing if a skin component cannot be instantiated correctly
This commit is contained in:
commit
6c172bac3c
@ -152,9 +152,23 @@ namespace osu.Game.Skinning
|
||||
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
Block a user