1
0
mirror of https://github.com/ppy/osu.git synced 2025-03-29 03:08:45 +08:00

Gracefully handle missing type rather than triggering ArgumentNullException

This commit is contained in:
Dean Herbert 2021-11-11 14:45:40 +09:00
parent 99d638677d
commit ea536dea23

View File

@ -129,7 +129,11 @@ namespace osu.Game.Rulesets
{
try
{
var instanceInfo = ((Ruleset)Activator.CreateInstance(Type.GetType(r.InstantiationInfo).AsNonNull())).RulesetInfo;
var resolvedType = Type.GetType(r.InstantiationInfo);
if (resolvedType != null)
{
var instanceInfo = ((Ruleset)Activator.CreateInstance(resolvedType)).RulesetInfo;
r.Name = instanceInfo.Name;
r.ShortName = instanceInfo.ShortName;
@ -137,6 +141,7 @@ namespace osu.Game.Rulesets
r.Available = true;
}
}
catch
{
r.Available = false;