1
0
Fork 1
mirror of https://github.com/TES3MP/openmw-tes3mp.git synced 2025-03-31 02:06:44 +00:00

[Server] Prevent SetGameMode() and SetHostname() from crashing server

Previously, turning off communication with the MasterServer from the server config and then attempting to use SetGameMode() or SetHostname() led to a server crash.
This commit is contained in:
David Cernat 2018-04-29 19:50:39 +03:00
parent 3b07dc4b42
commit d47b06fe7a

View file

@ -146,11 +146,13 @@ const char *ScriptFunctions::GetIP(unsigned short pid) noexcept
void ScriptFunctions::SetGameMode(const char *gameMode) noexcept void ScriptFunctions::SetGameMode(const char *gameMode) noexcept
{ {
if (mwmp::Networking::getPtr()->getMasterClient())
mwmp::Networking::getPtr()->getMasterClient()->SetModname(gameMode); mwmp::Networking::getPtr()->getMasterClient()->SetModname(gameMode);
} }
void ScriptFunctions::SetHostname(const char *name) noexcept void ScriptFunctions::SetHostname(const char *name) noexcept
{ {
if (mwmp::Networking::getPtr()->getMasterClient())
mwmp::Networking::getPtr()->getMasterClient()->SetHostname(name); mwmp::Networking::getPtr()->getMasterClient()->SetHostname(name);
} }