Skip to content

Commit

Permalink
[BUGFIX] Avoid error in imageLinkWrap for non-existing files
Browse files Browse the repository at this point in the history
ImageLinkWrap may not get a valid file object but will still try to
access methods on it which will fail. This patch implements a null check
resulting in simply not linking the image if the given file resource is
invalid.

Resolves: #88879
Releases: master, 9.5
Change-Id: I723596aa3b0a274a3565492b3d67a30b9d52389f
Reviewed-on: https://review.typo3.org/c/Packages/TYPO3.CMS/+/63914
Reviewed-by: Georg Ringer <georg.ringer@gmail.com>
Reviewed-by: Guido Schmechel <guido.schmechel@brandung.de>
Reviewed-by: Daniel Goerz <daniel.goerz@posteo.de>
Reviewed-by: Wouter Wolters <typo3@wouterwolters.nl>
Reviewed-by: Frank Nägler <frank.naegler@typo3.org>
Tested-by: TYPO3com <noreply@typo3.com>
Tested-by: Andreas Fernandez <a.fernandez@scripting-base.de>
Tested-by: Frank Nägler <frank.naegler@typo3.org>
  • Loading branch information
susannemoog authored and NeoBlack committed Mar 27, 2020
1 parent 1965d49 commit 67f5e90
Showing 1 changed file with 1 addition and 1 deletion.
Expand Up @@ -1314,7 +1314,7 @@ public function imageLinkWrap($string, $imageFile, $conf)
}

// Create imageFileLink if not created with typolink
if ($content === $string) {
if ($content === $string && $file !== null) {
$parameterNames = ['width', 'height', 'effects', 'bodyTag', 'title', 'wrap', 'crop'];
$parameters = [];
$sample = isset($conf['sample.']) ? $this->stdWrap($conf['sample'], $conf['sample.']) : $conf['sample'];
Expand Down

0 comments on commit 67f5e90

Please sign in to comment.