checks for empty settings

This commit is contained in:
Steffen Schröder 2014-01-05 16:04:36 +01:00
parent 3202194068
commit 417e460588
2 changed files with 2 additions and 8 deletions

View File

@ -107,10 +107,6 @@ class ScriptSettings implements ConfiguratorMenu, CallbackListener {
trigger_error($mysqli->error); trigger_error($mysqli->error);
return false; return false;
} }
if ($result->num_rows <= 0) {
$result->close();
return true;
}
$loadedSettings = array(); $loadedSettings = array();
while ($row = $result->fetch_object()) { while ($row = $result->fetch_object()) {
@ -119,6 +115,7 @@ class ScriptSettings implements ConfiguratorMenu, CallbackListener {
settype($loadedSettings[$row->settingName], gettype($scriptSettings[$row->settingName])); settype($loadedSettings[$row->settingName], gettype($scriptSettings[$row->settingName]));
} }
$result->close(); $result->close();
if (!$loadedSettings) return true;
$success = $this->maniaControl->client->query('SetModeScriptSettings', $loadedSettings); $success = $this->maniaControl->client->query('SetModeScriptSettings', $loadedSettings);
if (!$success) { if (!$success) {

View File

@ -97,10 +97,6 @@ class ServerSettings implements ConfiguratorMenu, CallbackListener {
trigger_error($mysqli->error); trigger_error($mysqli->error);
return false; return false;
} }
if ($result->num_rows <= 0) {
$result->close();
return true;
}
$this->maniaControl->client->query('GetServerOptions'); $this->maniaControl->client->query('GetServerOptions');
$serverSettings = $this->maniaControl->client->getResponse(); $serverSettings = $this->maniaControl->client->getResponse();
@ -111,6 +107,7 @@ class ServerSettings implements ConfiguratorMenu, CallbackListener {
settype($loadedSettings[$row->settingName], gettype($serverSettings[$row->settingName])); settype($loadedSettings[$row->settingName], gettype($serverSettings[$row->settingName]));
} }
$result->close(); $result->close();
if (!$loadedSettings) return true;
$success = $this->maniaControl->client->query('SetServerOptions', $loadedSettings); $success = $this->maniaControl->client->query('SetServerOptions', $loadedSettings);
if (!$success) { if (!$success) {