Skip to content

Commit 1d3eba2

Browse files
.
1 parent 733683d commit 1d3eba2

File tree

1 file changed

+14
-0
lines changed

1 file changed

+14
-0
lines changed

Server/mods/deathmatch/logic/CMainConfig.cpp

Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -133,6 +133,20 @@ bool CMainConfig::Load()
133133
return false;
134134
}
135135

136+
// Strip spaces from beginning and end of server name
137+
size_t snameStart = m_strServerName.find_first_not_of(" ");
138+
if (snameStart != std::string::npos)
139+
{
140+
size_t snameEnd = m_strServerName.find_last_not_of(" ");
141+
m_strServerName = m_strServerName.substr(snameStart, snameEnd - snameStart + 1);
142+
}
143+
else
144+
{
145+
// The string contains only spaces
146+
CLogger::ErrorPrintf("Server name must contain at least one character other than a space\n");
147+
return false;
148+
}
149+
136150
// Grab the forced server ip(s)
137151
GetString(m_pRootNode, "serverip", m_strServerIP);
138152
m_strServerIP = SString(m_strServerIP).Replace(" ", "");

0 commit comments

Comments
 (0)