mirror of
https://github.com/nextcloud/server.git
synced 2026-06-10 09:13:19 -04:00
Add explicit return if getSmallImagePreview fails
Signed-off-by: Julius Härtl <jus@bitgrid.net>
This commit is contained in:
parent
5a80df6e4c
commit
3742b7392d
1 changed files with 7 additions and 2 deletions
|
|
@ -115,7 +115,7 @@ class Generator {
|
|||
* Generates previews of a file
|
||||
*
|
||||
* @param File $file
|
||||
* @param array $specifications
|
||||
* @param non-empty-array $specifications
|
||||
* @param string $mimeType
|
||||
* @return ISimpleFile the last preview that was generated
|
||||
* @throws NotFoundException
|
||||
|
|
@ -213,6 +213,7 @@ class Generator {
|
|||
throw new NotFoundException('Cached preview size 0, invalid!');
|
||||
}
|
||||
}
|
||||
assert($preview !== null);
|
||||
|
||||
// Free memory being used by the embedded image resource. Without this the image is kept in memory indefinitely.
|
||||
// Garbage Collection does NOT free this memory. We have to do it ourselves.
|
||||
|
|
@ -226,8 +227,10 @@ class Generator {
|
|||
/**
|
||||
* Generate a small image straight away without generating a max preview first
|
||||
* Preview generated is 256x256
|
||||
*
|
||||
* @throws NotFoundException
|
||||
*/
|
||||
private function getSmallImagePreview(ISimpleFolder $previewFolder, File $file, string $mimeType, string $prefix, bool $crop) {
|
||||
private function getSmallImagePreview(ISimpleFolder $previewFolder, File $file, string $mimeType, string $prefix, bool $crop): ISimpleFile {
|
||||
$nodes = $previewFolder->getDirectoryListing();
|
||||
|
||||
foreach ($nodes as $node) {
|
||||
|
|
@ -284,6 +287,8 @@ class Generator {
|
|||
return $file;
|
||||
}
|
||||
}
|
||||
|
||||
throw new NotFoundException('No provider successfully handled the preview generation');
|
||||
}
|
||||
|
||||
/**
|
||||
|
|
|
|||
Loading…
Reference in a new issue