Netconsole: don't process empty input strings

Caught by assert in CUtlBuffer ctor when tokenizing the input.
This commit is contained in:
Kawe Mazidjatari 2024-01-14 11:48:42 +01:00
parent 3c10bf0e8d
commit cb8f0902a4

View File

@ -181,7 +181,11 @@ void CNetCon::TermSetup(const bool bAnsiColor)
//-----------------------------------------------------------------------------
void CNetCon::RunInput(const string& lineInput)
{
std::lock_guard<std::mutex> l(m_Mutex);
if (lineInput.empty())
{
// Empty string given, don't process it.
return;
}
if (lineInput.compare("nquit") == 0)
{
@ -189,6 +193,8 @@ void CNetCon::RunInput(const string& lineInput)
return;
}
std::lock_guard<std::mutex> l(m_Mutex);
if (IsConnected())
{
CCommand cmd;
@ -218,7 +224,7 @@ void CNetCon::RunInput(const string& lineInput)
cl_rcon::request_t::SERVERDATA_REQUEST_EXECCOMMAND);
}
}
else if (!lineInput.empty()) // Single arg command query.
else // Single arg command query.
{
bSend = Serialize(vecMsg, lineInput.c_str(), "", cl_rcon::request_t::SERVERDATA_REQUEST_EXECCOMMAND);
}