From c724902ca9da51ac8adbb05af28ab7136007fb10 Mon Sep 17 00:00:00 2001 From: David Reuss Date: Fri, 28 Oct 2011 08:06:30 -0700 Subject: [PATCH] Don't fail with no image macros Summary: .. IN (%Ls) with no file phids fails miserably. Test Plan: Went to /file/macro/ with and without patch. An exception is thrown without it. Reviewers: epriestley Reviewed By: epriestley CC: aran, epriestley Differential Revision: 1063 --- .../PhabricatorFileMacroListController.php | 16 ++++++++++------ 1 file changed, 10 insertions(+), 6 deletions(-) diff --git a/src/applications/files/controller/macrolist/PhabricatorFileMacroListController.php b/src/applications/files/controller/macrolist/PhabricatorFileMacroListController.php index 08d5f91b4f..40ff9e209e 100644 --- a/src/applications/files/controller/macrolist/PhabricatorFileMacroListController.php +++ b/src/applications/files/controller/macrolist/PhabricatorFileMacroListController.php @@ -43,12 +43,16 @@ class PhabricatorFileMacroListController extends PhabricatorFileController { $pager->setURI($request->getRequestURI(), 'page'); $file_phids = mpull($macros, 'getFilePHID'); - $files = id(new PhabricatorFile())->loadAllWhere( - "phid IN (%Ls)", - $file_phids); - $author_phids = mpull($files, 'getAuthorPHID', 'getPHID'); - $handles = id(new PhabricatorObjectHandleData($author_phids)) - ->loadHandles(); + + $files = array(); + if ($file_phids) { + $files = id(new PhabricatorFile())->loadAllWhere( + "phid IN (%Ls)", + $file_phids); + $author_phids = mpull($files, 'getAuthorPHID', 'getPHID'); + $handles = id(new PhabricatorObjectHandleData($author_phids)) + ->loadHandles(); + } $rows = array(); foreach ($macros as $macro) {