From b5b34ff6782c90af052062b7c407d02160183f8f Mon Sep 17 00:00:00 2001 From: "B. Endres" Date: Thu, 12 May 2022 13:04:03 +0200 Subject: [PATCH] [#42] fix for getProfile empty name --- CRM/Twingle/Profile.php | 16 ++++++++-------- 1 file changed, 8 insertions(+), 8 deletions(-) diff --git a/CRM/Twingle/Profile.php b/CRM/Twingle/Profile.php index 9ac1538..e5c0faf 100644 --- a/CRM/Twingle/Profile.php +++ b/CRM/Twingle/Profile.php @@ -366,19 +366,19 @@ class CRM_Twingle_Profile { /** * Retrieves the profile with the given name. * - * @param $name + * @param string $name * * @return CRM_Twingle_Profile | NULL */ public static function getProfile($name) { - $profile_data = CRM_Core_DAO::singleValueQuery("SELECT config FROM civicrm_twingle_profile WHERE name = %1", [ - 1 => [$name, 'String']]); - if ($profile_data) { - return new CRM_Twingle_Profile($name, json_decode($profile_data, 1)); - } - else { - return NULL; + if (!empty($name)) { + $profile_data = CRM_Core_DAO::singleValueQuery("SELECT config FROM civicrm_twingle_profile WHERE name = %1", [ + 1 => [$name, 'String']]); + if ($profile_data) { + return new CRM_Twingle_Profile($name, json_decode($profile_data, 1)); + } } + return NULL; } /**