NPE catched (TODO: We need to rewrite this?)
authorRoland Häder <roland@mxchange.org>
Fri, 21 Aug 2009 22:11:16 +0000 (22:11 +0000)
committerRoland Häder <roland@mxchange.org>
Fri, 21 Aug 2009 22:11:16 +0000 (22:11 +0000)
inc/classes/main/helper/web/forms/class_WebFormHelper.php

index 815db8d..b91f646 100644 (file)
@@ -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));