1
0
Fork 0
mirror of https://we.phorge.it/source/phorge.git synced 2024-09-20 09:18:48 +02:00

Prevent crash caused by empty array when rendering Pholio mocks

Summary: This was causing a crash according to a conversation with @rfergu in IRC.  The issue is that if `$images_to_show` is empty, then `$image` never gets set, and it attempts to call `getID` on a null / unset variable.

Test Plan: @rfergu confirmed this fixed the crash.

Reviewers: #blessed_reviewers, epriestley

Reviewed By: #blessed_reviewers, epriestley

Subscribers: Korvin, rfergu, epriestley

Differential Revision: https://secure.phabricator.com/D10073
This commit is contained in:
James Rhodes 2014-07-31 08:10:22 +10:00
parent 8afd8f56f4
commit de40cf5ef7

View file

@ -26,6 +26,9 @@ final class PholioMockEmbedView extends AphrontView {
if (!empty($this->images)) {
$images_to_show = array_intersect_key(
$this->mock->getImages(), array_flip($this->images));
}
if ($images_to_show) {
foreach ($images_to_show as $image) {
$thumbfile = $image->getFile();
$thumbnail = $thumbfile->getThumb280x210URI();