From a52de11592c85a4de76b6dc0f7432795dc94ead9 Mon Sep 17 00:00:00 2001
From: Chris Burgess <chris@fuzion.co.nz>
Date: Thu, 27 Mar 2014 11:40:46 +1300
Subject: [PATCH] Issue CRM-14394. Check that $path is not NULL, and that the
 file exists.

---
 CRM/Core/BAO/CustomGroup.php | 10 ++++++----
 1 file changed, 6 insertions(+), 4 deletions(-)

diff --git a/CRM/Core/BAO/CustomGroup.php b/CRM/Core/BAO/CustomGroup.php
index 90654c569f..3e5c355ecd 100644
--- a/CRM/Core/BAO/CustomGroup.php
+++ b/CRM/Core/BAO/CustomGroup.php
@@ -773,10 +773,12 @@ ORDER BY civicrm_custom_group.weight,
             list($path) = CRM_Core_BAO_File::path($fileDAO->id, $entityId,
               NULL, NULL
             );
-            list($imageWidth, $imageHeight) = getimagesize($path);
-            list($imageThumbWidth, $imageThumbHeight) = CRM_Contact_BAO_Contact::getThumbSize($imageWidth, $imageHeight);
-            $customValue['imageThumbWidth'] = $imageThumbWidth;
-            $customValue['imageThumbHeight'] = $imageThumbHeight;
+            if ($path && file_exists($path)) {
+              list($imageWidth, $imageHeight) = getimagesize($path);
+              list($imageThumbWidth, $imageThumbHeight) = CRM_Contact_BAO_Contact::getThumbSize($imageWidth, $imageHeight);
+              $customValue['imageThumbWidth'] = $imageThumbWidth;
+              $customValue['imageThumbHeight'] = $imageThumbHeight;
+            }
           }
         }
       }
-- 
GitLab