exception crash avoidance fixes

This commit is contained in:
kremsy 2017-02-11 23:26:28 +01:00
parent a35835e1f6
commit f44f56a5dc
3 changed files with 22 additions and 3 deletions

View File

@ -20,6 +20,7 @@ use ManiaControl\Communication\CommunicationMethods;
use ManiaControl\Logger; use ManiaControl\Logger;
use ManiaControl\ManiaControl; use ManiaControl\ManiaControl;
use ManiaControl\Players\Player; use ManiaControl\Players\Player;
use Maniaplanet\DedicatedServer\Xmlrpc\FaultException;
use Maniaplanet\DedicatedServer\Xmlrpc\GameModeException; use Maniaplanet\DedicatedServer\Xmlrpc\GameModeException;
/** /**
@ -345,7 +346,12 @@ class ScriptSettings implements ConfiguratorMenu, CallbackListener, Communicatio
return true; return true;
} }
try {
$this->maniaControl->getClient()->setModeScriptSettings($newSettings); $this->maniaControl->getClient()->setModeScriptSettings($newSettings);
} catch (FaultException $e) {
return false;
}
// Save Settings into Database // Save Settings into Database
$mysqli = $this->maniaControl->getDatabase()->getMysqli(); $mysqli = $this->maniaControl->getDatabase()->getMysqli();
@ -380,8 +386,6 @@ class ScriptSettings implements ConfiguratorMenu, CallbackListener, Communicatio
} }
// Add To Database // Add To Database
$settingName = $setting;
$settingValue = $value;
$statement->execute(); $statement->execute();
if ($statement->error) { if ($statement->error) {
trigger_error($statement->error); trigger_error($statement->error);

View File

@ -8,10 +8,12 @@ use FML\Controls\Labels\Label_Text;
use FML\ManiaLink; use FML\ManiaLink;
use ManiaControl\Callbacks\CallbackListener; use ManiaControl\Callbacks\CallbackListener;
use ManiaControl\Callbacks\CallbackManager; use ManiaControl\Callbacks\CallbackManager;
use ManiaControl\Logger;
use ManiaControl\ManiaControl; use ManiaControl\ManiaControl;
use ManiaControl\Players\Player; use ManiaControl\Players\Player;
use Maniaplanet\DedicatedServer\Xmlrpc\FaultException; use Maniaplanet\DedicatedServer\Xmlrpc\FaultException;
use Maniaplanet\DedicatedServer\Xmlrpc\GameModeException; use Maniaplanet\DedicatedServer\Xmlrpc\GameModeException;
use Maniaplanet\DedicatedServer\Xmlrpc\MessageException;
use Maniaplanet\DedicatedServer\Xmlrpc\UnknownPlayerException; use Maniaplanet\DedicatedServer\Xmlrpc\UnknownPlayerException;
/** /**
@ -266,6 +268,9 @@ class ManialinkManager implements ManialinkPageAnswerListener, CallbackListener
//TODO added 17.01.2015, remove later: //TODO added 17.01.2015, remove later:
$this->maniaControl->getErrorHandler()->triggerDebugNotice("Fault Exception: ManiaLink Manager, Message: " . $e->getMessage()); $this->maniaControl->getErrorHandler()->triggerDebugNotice("Fault Exception: ManiaLink Manager, Message: " . $e->getMessage());
return false; return false;
} catch (MessageException $e) {
//TODO verify why this can happen
Logger::logError("Request too large during opening Directory Browser");
} }
return true; return true;

View File

@ -258,6 +258,11 @@ class PlayerActions implements EchoListener, CommunicationListener {
$this->maniaControl->getChat()->sendException($exception, $admin); $this->maniaControl->getChat()->sendException($exception, $admin);
} }
return false; return false;
} catch (UnknownPlayerException $exception) {
if ($calledByAdmin) {
$this->maniaControl->getChat()->sendException($exception, $admin);
}
return false;
} }
if ($userIsAbleToSelect) { if ($userIsAbleToSelect) {
@ -555,6 +560,11 @@ class PlayerActions implements EchoListener, CommunicationListener {
$this->maniaControl->getChat()->sendException($e, $admin); $this->maniaControl->getChat()->sendException($e, $admin);
} }
return false; return false;
} catch (UnknownPlayerException $e) { //TODO check why it's actually needed, but there was a crash at this place
if ($calledByAdmin) {
$this->maniaControl->getChat()->sendException($e, $admin);
}
return false;
} }
} else { } else {
try { try {