NPE catched (TODO: We need to rewrite this?)
[core.git] / inc / classes / main / helper / web / forms / class_WebFormHelper.php
index 815db8d9c03d7468cacb40ab2784994e3be6eefc..b91f646adba48305fbe3ee1ebe344a27d15ba925 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));