Fix bug where Enum.Parse would always pass if a number was given as argument in rank

This commit is contained in:
runebaas 2019-05-12 17:29:07 +02:00
parent 5109cc03a4
commit 3e3cbc257e
No known key found for this signature in database
GPG key ID: 2677AF508D0300D6

View file

@ -1,4 +1,4 @@
using System; using System;
using System.Collections.Generic; using System.Collections.Generic;
using System.Linq; using System.Linq;
using System.Text; using System.Text;
@ -46,7 +46,8 @@ namespace Geekbot.net.Commands.User.Ranking
HighscoreTypes type; HighscoreTypes type;
try try
{ {
type = Enum.Parse<HighscoreTypes>(typeUnformated.ToLower()); type = Enum.Parse<HighscoreTypes>(typeUnformated, true);
if (!Enum.IsDefined(typeof(HighscoreTypes), type)) throw new Exception();
} }
catch catch
{ {