1
0
mirror of https://github.com/ppy/osu.git synced 2024-11-11 11:37:28 +08:00

Fallback to default skin if instantiation fails

This commit is contained in:
Dean Herbert 2022-09-15 15:49:26 +09:00
parent 3e28ab72ce
commit 487378f732

View File

@ -47,7 +47,17 @@ namespace osu.Game.Skinning
? typeof(LegacySkin)
: Type.GetType(InstantiationInfo).AsNonNull();
return (Skin)Activator.CreateInstance(type, this, resources);
try
{
return (Skin)Activator.CreateInstance(type, this, resources);
}
catch
{
// This defaults to triangles to catch the case where a user has a modified triangles skin.
// If we ever add more default skins in the future this will need some kind of proper migration rather than
// a single catch.
return new DefaultSkinTriangles(this, resources);
}
}
public IList<RealmNamedFileUsage> Files { get; } = null!;