Skip to content

Commit

Permalink
Fix #6598: Added company id check for connect console command.
Browse files Browse the repository at this point in the history
  • Loading branch information
Foxar committed Nov 29, 2020
1 parent d19f7b9 commit e82c32b
Showing 1 changed file with 6 additions and 0 deletions.
6 changes: 6 additions & 0 deletions src/console_cmds.cpp
Expand Up @@ -919,6 +919,12 @@ DEF_CONSOLE_CMD(ConNetworkConnect)
IConsolePrintF(CC_DEFAULT, "Connecting to %s...", ip);
if (company != nullptr) {
join_as = (CompanyID)atoi(company);
IConsolePrintF(CC_DEFAULT, "Connecting as company id %s ...", company);
/* Check if we have a valid company id! */
if(!Company::IsValidID(join_as) && join_as != COMPANY_SPECTATOR){
IConsolePrintF(CC_ERROR, "Company does not exist. Company-id must be between 1 and %d.", MAX_COMPANIES);
return true;
}
IConsolePrintF(CC_DEFAULT, " company-no: %d", join_as);

/* From a user pov 0 is a new company, internally it's different and all
Expand Down

0 comments on commit e82c32b

Please sign in to comment.