// By default they want to help.
$ifGovHelps = true;
- // First get a government instance from registry
- $governmentInstance = Registry::getRegistry()->getInstance('government');
+ // Init instance
+ $governmentInstance = null;
+
+ try {
+ // First get a government instance from registry
+ $governmentInstance = Registry::getRegistry()->getInstance('government');
+ } catch (NullPointerException $e) {
+ // Instance not found in registry
+ // @TODO We should log this exception later
+ }
// Is it there?
if (is_null($governmentInstance)) {
// By default they want to help.
$ifGovHelps = true;
- // First get a government instance from registry
- $governmentInstance = Registry::getRegistry()->getInstance('government');
+ // Init instance
+ $governmentInstance = null;
+
+ try {
+ // First get a government instance from registry
+ $governmentInstance = Registry::getRegistry()->getInstance('government');
+ } catch (NullPointerException $e) {
+ // Instance not found in registry
+ // @TODO We should log this exception later
+ }
// Is it there?
if (is_null($governmentInstance)) {
// Per default the money bank cannot pay
$bankLends = false;
- // Get a money bank instance from registry
- $bankInstance = Registry::getRegistry()->getInstance('money_bank');
+ // Init instance
+ $bankInstance = null;
+
+ try {
+ // Get a money bank instance from registry
+ $bankInstance = Registry::getRegistry()->getInstance('money_bank');
+ } catch (NullPointerException $e) {
+ // Instance not found in registry
+ // @TODO We should log this exception later
+ }
// Is it there?
if (is_null($bankInstance)) {
// For default he can still get money
$hasMaxCredits = false;
- // Get a money bank instance from registry
- $bankInstance = Registry::getRegistry()->getInstance('money_bank');
+ // Init instance
+ $bankInstance = null;
+
+ try {
+ // Get a money bank instance from registry
+ $bankInstance = Registry::getRegistry()->getInstance('money_bank');
+ } catch (NullPointerException $e) {
+ // Instance not found in registry
+ // @TODO We should log this exception later
+ }
// Is it there?
if (is_null($bankInstance)) {