mirror of
https://github.com/mangosfour/server.git
synced 2025-12-16 04:37:00 +00:00
Fixed crash at using .account set gmlevel with wrong args.
This commit is contained in:
parent
4476d483d4
commit
8fc5ac7fd3
1 changed files with 8 additions and 0 deletions
|
|
@ -682,6 +682,7 @@ bool ChatHandler::HandleAccountSetGmLevelCommand(const char* args)
|
||||||
if( !arg1 )
|
if( !arg1 )
|
||||||
return false;
|
return false;
|
||||||
|
|
||||||
|
/// must be NULL if targeted syntax and must be not nULL if not targeted
|
||||||
char* arg2 = strtok(NULL, " ");
|
char* arg2 = strtok(NULL, " ");
|
||||||
|
|
||||||
std::string targetAccountName;
|
std::string targetAccountName;
|
||||||
|
|
@ -696,6 +697,9 @@ bool ChatHandler::HandleAccountSetGmLevelCommand(const char* args)
|
||||||
if(arg2)
|
if(arg2)
|
||||||
return false;
|
return false;
|
||||||
|
|
||||||
|
/// security level expected in arg2 after this if.
|
||||||
|
arg2 = arg1;
|
||||||
|
|
||||||
targetAccountId = targetPlayer->GetSession()->GetAccountId();
|
targetAccountId = targetPlayer->GetSession()->GetAccountId();
|
||||||
targetSecurity = targetPlayer->GetSession()->GetSecurity();
|
targetSecurity = targetPlayer->GetSession()->GetSecurity();
|
||||||
if(!accmgr.GetName(targetAccountId,targetAccountName))
|
if(!accmgr.GetName(targetAccountId,targetAccountName))
|
||||||
|
|
@ -707,6 +711,10 @@ bool ChatHandler::HandleAccountSetGmLevelCommand(const char* args)
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
|
/// wrong command syntax (second arg expected)
|
||||||
|
if(!arg2)
|
||||||
|
return false;
|
||||||
|
|
||||||
targetAccountName = arg1;
|
targetAccountName = arg1;
|
||||||
if(!AccountMgr::normilizeString(targetAccountName))
|
if(!AccountMgr::normilizeString(targetAccountName))
|
||||||
{
|
{
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue