Replace most T.Parse with T.TryParse for all user input.
This commit is contained in:
@@ -40,11 +40,9 @@ namespace Game.Chat
|
||||
// .addquest #entry'
|
||||
// number or [name] Shift-click form |color|Hquest:quest_id:quest_level|h[name]|h|r
|
||||
string cId = handler.extractKeyFromLink(args, "Hquest");
|
||||
if (string.IsNullOrEmpty(cId))
|
||||
if (!uint.TryParse(cId, out uint entry))
|
||||
return false;
|
||||
|
||||
uint entry = uint.Parse(cId);
|
||||
|
||||
Quest quest = Global.ObjectMgr.GetQuestTemplate(entry);
|
||||
if (quest == null)
|
||||
{
|
||||
@@ -82,11 +80,9 @@ namespace Game.Chat
|
||||
// .quest complete #entry
|
||||
// number or [name] Shift-click form |color|Hquest:quest_id:quest_level|h[name]|h|r
|
||||
string cId = handler.extractKeyFromLink(args, "Hquest");
|
||||
if (string.IsNullOrEmpty(cId))
|
||||
if (!uint.TryParse(cId, out uint entry))
|
||||
return false;
|
||||
|
||||
uint entry = uint.Parse(cId);
|
||||
|
||||
Quest quest = Global.ObjectMgr.GetQuestTemplate(entry);
|
||||
|
||||
// If player doesn't have the quest
|
||||
@@ -176,11 +172,9 @@ namespace Game.Chat
|
||||
// .removequest #entry'
|
||||
// number or [name] Shift-click form |color|Hquest:quest_id:quest_level|h[name]|h|r
|
||||
string cId = handler.extractKeyFromLink(args, "Hquest");
|
||||
if (string.IsNullOrEmpty(cId))
|
||||
if (!uint.TryParse(cId, out uint entry))
|
||||
return false;
|
||||
|
||||
uint entry = uint.Parse(cId);
|
||||
|
||||
Quest quest = Global.ObjectMgr.GetQuestTemplate(entry);
|
||||
if (quest == null)
|
||||
{
|
||||
@@ -229,11 +223,9 @@ namespace Game.Chat
|
||||
// .quest reward #entry
|
||||
// number or [name] Shift-click form |color|Hquest:quest_id:quest_level|h[name]|h|r
|
||||
string cId = handler.extractKeyFromLink(args, "Hquest");
|
||||
if (string.IsNullOrEmpty(cId))
|
||||
if (!uint.TryParse(cId, out uint entry))
|
||||
return false;
|
||||
|
||||
uint entry = uint.Parse(cId);
|
||||
|
||||
Quest quest = Global.ObjectMgr.GetQuestTemplate(entry);
|
||||
|
||||
// If player doesn't have the quest
|
||||
|
||||
Reference in New Issue
Block a user