Skip to content
This repository has been archived by the owner on Jul 25, 2023. It is now read-only.

Commit

Permalink
Return if no assets are set
Browse files Browse the repository at this point in the history
  • Loading branch information
Darren Belding committed Feb 28, 2017
1 parent 887bdba commit e361034
Showing 1 changed file with 7 additions and 1 deletion.
8 changes: 7 additions & 1 deletion src/Block/Head/Preload.php
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,13 @@ public function __construct(
*/
protected function _toHtml() {
$html = '';
foreach ($this->getAssets() as $asset) {
$assets = $this->getAssets();

if (empty($assets)) {
return;
}

foreach ($assets as $asset) {
$attributesHtml = sprintf('%s="%s"', $asset['attributes']['name'], $asset['attributes']['value']);
$assetUrl = $this->_assetRepo->getUrl($asset['path']);
$html .= sprintf($this->_template, $assetUrl, $attributesHtml);
Expand Down

0 comments on commit e361034

Please sign in to comment.