From c2c7aa239cb9cdf17fcec638c256700374b90a32 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Steffen=20Schro=CC=88der?= Date: Thu, 10 Jul 2014 18:53:16 +0200 Subject: [PATCH] check validity of saved server settings added missing property for validity check --- application/core/Configurators/ServerSettings.php | 7 ++++++- .../DedicatedServer/Structures/ServerOptions.php | 3 ++- 2 files changed, 8 insertions(+), 2 deletions(-) diff --git a/application/core/Configurators/ServerSettings.php b/application/core/Configurators/ServerSettings.php index 5d7f9c40..12fc5177 100644 --- a/application/core/Configurators/ServerSettings.php +++ b/application/core/Configurators/ServerSettings.php @@ -123,8 +123,13 @@ class ServerSettings implements ConfiguratorMenu, CallbackListener { return true; } + $serverOptions = ServerOptions::fromArray($savedSettings); + if (!$serverOptions->isValid()) { + $message = "Couldn't load server settings from database because of their invalid state."; + $this->maniaControl->chat->sendErrorToAdmins($message); + return false; + } try { - $serverOptions = ServerOptions::fromArray($savedSettings); return $this->maniaControl->client->setServerOptions($serverOptions); } catch (ServerOptionsException $exception) { $this->maniaControl->chat->sendExceptionToAdmins($exception); diff --git a/application/core/Libs/Maniaplanet/DedicatedServer/Structures/ServerOptions.php b/application/core/Libs/Maniaplanet/DedicatedServer/Structures/ServerOptions.php index 86ac17fb..131ee013 100755 --- a/application/core/Libs/Maniaplanet/DedicatedServer/Structures/ServerOptions.php +++ b/application/core/Libs/Maniaplanet/DedicatedServer/Structures/ServerOptions.php @@ -82,7 +82,8 @@ class ServerOptions extends AbstractStructure && is_string($this->comment) && is_string($this->password) && is_string($this->passwordForSpectator) - && VoteRatio::isRatio($this->callVoteRatio); + && VoteRatio::isRatio($this->callVoteRatio) + && is_int($this->nextCallVoteTimeOut); } /**