mirror of
https://github.com/ppy/osu.git
synced 2025-01-29 02:12:57 +08:00
Merge pull request #17594 from peppy/move-skin-component-error-handling
Move `SkinnableInfo` error handling to lower level
This commit is contained in:
commit
cabf6f501f
@ -9,6 +9,7 @@ using Newtonsoft.Json;
|
||||
using osu.Framework.Bindables;
|
||||
using osu.Framework.Graphics;
|
||||
using osu.Framework.Graphics.Containers;
|
||||
using osu.Framework.Logging;
|
||||
using osu.Game.Configuration;
|
||||
using osu.Game.Extensions;
|
||||
using osu.Game.Skinning;
|
||||
@ -84,9 +85,17 @@ namespace osu.Game.Screens.Play.HUD
|
||||
/// <returns>The new instance.</returns>
|
||||
public Drawable CreateInstance()
|
||||
{
|
||||
Drawable d = (Drawable)Activator.CreateInstance(Type);
|
||||
d.ApplySkinnableInfo(this);
|
||||
return d;
|
||||
try
|
||||
{
|
||||
Drawable d = (Drawable)Activator.CreateInstance(Type);
|
||||
d.ApplySkinnableInfo(this);
|
||||
return d;
|
||||
}
|
||||
catch (Exception e)
|
||||
{
|
||||
Logger.Error(e, $"Unable to create skin component {Type.Name}");
|
||||
return Drawable.Empty();
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -155,16 +155,7 @@ namespace osu.Game.Skinning
|
||||
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}");
|
||||
}
|
||||
}
|
||||
components.Add(i.CreateInstance());
|
||||
|
||||
return new SkinnableTargetComponentsContainer
|
||||
{
|
||||
|
Loading…
Reference in New Issue
Block a user