mirror of
https://we.phorge.it/source/phorge.git
synced 2024-12-24 06:20:56 +01: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:
parent
8afd8f56f4
commit
de40cf5ef7
1 changed files with 3 additions and 0 deletions
|
@ -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();
|
||||
|
|
Loading…
Reference in a new issue