From 76d556c7020825d2ce68445116f42a4f734b3464 Mon Sep 17 00:00:00 2001 From: =?utf8?q?Frank=20J=2E=20G=C3=B3mez?= Date: Fri, 13 Oct 2017 08:21:45 -0400 Subject: [PATCH] CRM-21300: Addressed notices due to unexpected NULL from Joomla DB object. --- CRM/Core/Permission/Joomla.php | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/CRM/Core/Permission/Joomla.php b/CRM/Core/Permission/Joomla.php index 090d30ab36..17a768770b 100644 --- a/CRM/Core/Permission/Joomla.php +++ b/CRM/Core/Permission/Joomla.php @@ -181,8 +181,9 @@ class CRM_Core_Permission_Joomla extends CRM_Core_Permission_Base { $db->setQuery($query); - // Load the result as a stdClass object, decoding JSON on the way - return json_decode($db->loadObject()->rules); + // Joomla gotcha: loadObject returns NULL in the case of no matches. + $result = $db->loadObject(); + return $result ? json_decode($result->rules) : (object) array(); } /** -- 2.25.1