mirror of
https://github.com/osukey/osukey.git
synced 2025-08-04 07:06:35 +09:00
Use SingleOrDefault for added safety when looking up mod acronyms
This commit is contained in:
@ -36,7 +36,7 @@ namespace osu.Game.Online.API
|
||||
|
||||
public Mod ToMod(Ruleset ruleset)
|
||||
{
|
||||
Mod resultMod = ruleset.GetAllMods().FirstOrDefault(m => m.Acronym == Acronym);
|
||||
Mod resultMod = ruleset.GetAllMods().SingleOrDefault(m => m.Acronym == Acronym);
|
||||
|
||||
if (resultMod == null)
|
||||
throw new InvalidOperationException($"There is no mod in the ruleset ({ruleset.ShortName}) matching the acronym {Acronym}.");
|
||||
|
Reference in New Issue
Block a user