1
0
mirror of https://github.com/ppy/osu.git synced 2024-12-15 09:42:54 +08:00

Handle possible null reference;

This commit is contained in:
HoutarouOreki 2018-07-21 09:37:58 +02:00
parent 78f0f37ee6
commit 22af3cd923

View File

@ -28,9 +28,10 @@ namespace osu.Game.Graphics
public static ColourInfo FromStreamName(string name) public static ColourInfo FromStreamName(string name)
{ {
if (colours.TryGetValue(name, out ColourInfo colour)) if (!string.IsNullOrEmpty(name))
return colour; if (colours.TryGetValue(name, out ColourInfo colour))
else return new Color4(255, 255, 255, 255); return colour;
return new Color4(255, 255, 255, 255);
} }
} }
} }