Trying to get property of non-object - if active menu null

Admiror Gallery is free extension for Joomla! based websites. Admiror Gallery is all in one, a simple and instant solution for rendering image gallery from folder with images, but very flexible and adaptable.
Post Reply
Message
Author
tkuschel
Posts: 2
Joined: Fri Jan 09, 2015 4:45 pm

Trying to get property of non-object - if active menu null

#1 Post by tkuschel »

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: Select all

// 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: Select all

--- 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;


Admiror Gallery 5 - Fundraising Campaign

User avatar
Vasiljevski
Developer
Developer
Posts: 1258
Joined: Sat Aug 14, 2010 9:31 pm
Location: Novi Sad, Serbia
Contact:

Re: Trying to get property of non-object - if active menu nu

#2 Post by Vasiljevski »

Thanks for reporting this. I added it to our Git repository in revision 4 :)
Help Admiror Gallery become even better,
give us a review on JED

Post Reply