Details
-
Task
-
Resolution: Unresolved
-
Neutral
-
None
-
1.6.3
-
None
-
None
-
-
Empty show more show less
-
Empty show more show less
Description
Reproduce
- Upload a new Asset.
- Use this Asset in a textImage component
- Publish the page you linked in the component to the asset -> Render the page on the public -> reproduction on public
OR
Delete the Asset -> Render the page on the public -> reproduction on Author.
Problem
The textImage component renders a null-pointer error if the is an non-rsolvable asset link.
There is a missing null handling -> "assetLink could not be resolved to an asset via the damfn.
Solution
Use this code:
With a proper null check on the 'rendition' object.
[#if content.image?has_content] [#assign rendition = damfn.getRendition(content.image, "original")!] [#if rendition?has_content] [#assign hasImage = true] [#assign divClass = "${divClass} text-image-section"] [#assign imageClass = "content-image-${imagePosition}"] [#include "/travel-demo/templates/macros/imageResponsive.ftl"] [#assign imageHtml][@imageResponsive rendition content imageClass false def.parameters /][/#assign] [/#if] [/#if]
I have attached the whole script file to replace.
textImage.ftl![]()
Checklists
Acceptance criteria