Core/Commands: Correction to 57490ead83, when ip parameter is supplied it should be used over selection

This commit is contained in:
Shauren
2012-01-12 21:02:19 +01:00
parent 7684340fe2
commit d3f66dfe6d

View File

@@ -712,19 +712,20 @@ bool ChatHandler::HandleLookupPlayerIpCommand(const char* args)
char* limit_str;
Player *chr = getSelectedPlayer();
if (chr == NULL)
if (!*args)
{
if (!*args)
// NULL only if used from console
if (!chr || chr == GetSession()->GetPlayer())
return false;
ip = strtok ((char*)args, " ");
limit_str = strtok (NULL, " ");
limit = limit_str ? atoi (limit_str) : -1;
ip = chr->GetSession()->GetRemoteAddress();
limit = -1;
}
else
{
ip = chr->GetSession()->GetRemoteAddress();
limit = -1;
ip = strtok ((char*)args, " ");
limit_str = strtok (NULL, " ");
limit = limit_str ? atoi (limit_str) : -1;
}
LoginDatabase.EscapeString(ip);