Admiror Joomla! Community
http://www.vasiljevski.com/forum/

Trying to get property of non-object - if active menu null
http://www.vasiljevski.com/forum/viewtopic.php?f=30&t=1416
Page 1 of 1

Author:  tkuschel [ Fri Jan 09, 2015 5:06 pm ]
Post subject:  Trying to get property of non-object - if active menu null

Hi,
if a menu structure was changed or article is available through the joola compontent (without a menu) a message is thrown:
[Fri Jan 09 14:42:01 2015] [error] [client 68.180.228.169] PHP Notice: Trying to get property of non-object in /var/www/cms/plugins/content/admirorgallery/admirorgallery/classes/agGallery.php on line 353
[Fri Jan 09 15:03:29 2015] [error] [client 212.186.180.210] PHP Notice: Trying to get property of non-object in /var/www/cms/plugins/content/admirorgallery/admirorgallery/classes/agGallery.php on line 353

At line 353, I changed it to:
Code:
// Breadcrump Support
         $active = JFactory::getApplication()->getMenu()->getActive();
         if (isset($active) && $active->query['view'] == 'layout')  $this->writeBreadcrum();


so only when menu item is not null and exists, the writeBreadcrum() is called;

Thomas

patch:
Code:
--- agGallery_orig.php   2015-01-09 15:04:25.000000000 +0100
+++ agGallery.php   2015-01-09 15:31:50.000000000 +0100
@@ -1,5 +1,6 @@
 <?php
  /*------------------------------------------------------------------------
+ LOYTEC patch 2015-01-09
 # admirorgallery - Admiror Gallery Plugin
 # ------------------------------------------------------------------------
 # author   Igor Kekeljevic & Nikola Vasiljevski
@@ -348,12 +349,14 @@
                         ';
                 }
             }
-
-            // Breadcrump Support           
-            if (JFactory::getApplication()->getMenu()->getActive()->query['view'] == "layout") {
-                $this->writeBreadcrum();
-            }
-
+         //tk LOYTEC patch 2015-01-09
+         // Breadcrump Support
+         $active = JFactory::getApplication()->getMenu()->getActive();
+         if (isset($active) && $active->query['view'] == 'layout') $this->writeBreadcrum();
+         /*if (JFactory::getApplication()->getMenu()->getActive()->query['view'] == "layout") {
+            $this->writeBreadcrum();
+         }
+         */ //tk--
             $this->doc->addScriptDeclaration('var albumInitFolders_' . $this->articleID . '="' . implode(",", $this->albumInitFolders) . '";');
         }
         $this->imagesFolderPhysicalPath = $this->sitePhysicalPath . $this->params['rootFolder'] . $this->imagesFolderName . DS;


Author:  Vasiljevski [ Thu Mar 19, 2015 3:26 pm ]
Post subject:  Re: Trying to get property of non-object - if active menu nu

Thanks for reporting this. I added it to our Git repository in revision 4 :)

Page 1 of 1 All times are UTC + 1 hour [ DST ]
Powered by phpBB® Forum Software © phpBB Group
https://www.phpbb.com/