Replace most T.Parse with T.TryParse for all user input.

This commit is contained in:
hondacrx
2017-11-05 15:21:29 -05:00
parent 8c863de8a6
commit 8ed446ae7a
40 changed files with 477 additions and 527 deletions
+3 -6
View File
@@ -35,8 +35,7 @@ namespace Game.Chat.Commands
if (string.IsNullOrEmpty(id_p))
return false;
uint id = uint.Parse(id_p);
if (id == 0)
if (!uint.TryParse(id_p, out uint id) || id == 0)
{
handler.SendSysMessage(CypherStrings.InvalidTitleId, id);
return false;
@@ -77,8 +76,7 @@ namespace Game.Chat.Commands
if (string.IsNullOrEmpty(id_p))
return false;
uint id = uint.Parse(id_p);
if (id == 0)
if (!uint.TryParse(id_p, out uint id) || id == 0)
{
handler.SendSysMessage(CypherStrings.InvalidTitleId, id);
return false;
@@ -120,8 +118,7 @@ namespace Game.Chat.Commands
if (string.IsNullOrEmpty(id_p))
return false;
uint id = uint.Parse(id_p);
if (id == 0)
if (!uint.TryParse(id_p, out uint id) || id == 0)
{
handler.SendSysMessage(CypherStrings.InvalidTitleId, id);
return false;