Entitycmd: Added try-catch statement around the Enum.Parse instruction

This commit is contained in:
ITHackerstein 2022-11-24 08:30:45 +01:00
parent 3d2b9b22a3
commit 30861a92ee

View file

@ -126,7 +126,16 @@ namespace MinecraftClient.Commands
} }
catch (FormatException) catch (FormatException)
{ {
EntityType interacttype = Enum.Parse<EntityType>(args[0]); EntityType interacttype;
try
{
interacttype = Enum.Parse<EntityType>(args[0]);
}
catch (Exception)
{
return Translations.cmd_entityCmd_not_found;
}
string action = args.Length > 1 string action = args.Length > 1
? args[1].ToLower() ? args[1].ToLower()
: "list"; : "list";