From: Roland Häder Date: Fri, 21 Aug 2009 22:11:16 +0000 (+0000) Subject: NPE catched (TODO: We need to rewrite this?) X-Git-Url: https://git.mxchange.org/?a=commitdiff_plain;h=d8920550e524b1515d30da9a2d45b807782ab789;p=core.git NPE catched (TODO: We need to rewrite this?) --- diff --git a/inc/classes/main/helper/web/forms/class_WebFormHelper.php b/inc/classes/main/helper/web/forms/class_WebFormHelper.php index 815db8d9..b91f646a 100644 --- a/inc/classes/main/helper/web/forms/class_WebFormHelper.php +++ b/inc/classes/main/helper/web/forms/class_WebFormHelper.php @@ -672,8 +672,16 @@ class WebFormHelper extends BaseWebHelper implements HelpableTemplate { * @return void */ public function addCaptcha () { - // Get last executed pre filter - $extraInstance = Registry::getRegistry()->getInstance('extra'); + // Init instance + $extraInstance = null; + + try { + // Get last executed pre filter + $extraInstance = Registry::getRegistry()->getInstance('extra'); + } catch (NullPointerException $e) { + // Instance in registry is not set (null) + // @TODO We need to log this later + } // Get a configured instance $captchaInstance = ObjectFactory::createObjectByConfiguredName($this->getFormName().'_captcha', array($this, $extraInstance));