diff --git a/typo3/sysext/frontend/Classes/ContentObject/FilesContentObject.php b/typo3/sysext/frontend/Classes/ContentObject/FilesContentObject.php
index 57cd32246dd8bcca67fafb023f17e68d2c5ee08b..5d0e4822e515701906f432476f6eecc8a146308d 100644
--- a/typo3/sysext/frontend/Classes/ContentObject/FilesContentObject.php
+++ b/typo3/sysext/frontend/Classes/ContentObject/FilesContentObject.php
@@ -138,7 +138,7 @@ class FilesContentObject extends \TYPO3\CMS\Frontend\ContentObject\AbstractConte
 					try {
 						$folder = $this->getFileFactory()->getFolderObjectFromCombinedIdentifier($folderIdentifier);
 						if ($folder instanceof \TYPO3\CMS\Core\Resource\Folder) {
-							$this->addToArray($folder->getFiles(), $fileObjects);
+							$this->addToArray(array_values($folder->getFiles()), $fileObjects);
 						}
 					} catch (\TYPO3\CMS\Core\Resource\Exception $e) {
 						/** @var \TYPO3\CMS\Core\Log\Logger $logger */