null One on One with Danny Byrd

An error occurred while processing the template.
The following has evaluated to null or missing:
==> cmsEntity.getLocalizedField(profile, "/entity/assets/mainImage")  [in template "20116#20152#251097" at line 35, column 24]

----
Tip: If the failing expression is known to be legally refer to something that's sometimes null or missing, either specify a default value like myOptionalVar!myDefault, or use <#if myOptionalVar??>when-present<#else>when-missing</#if>. (These only cover the last step of the expression; to cover the whole expression, use parenthesis: (myOptionalVar.foo)!myDefault, (myOptionalVar.foo)??
----

----
FTL stack trace ("~" means nesting-related):
	- Failed at: #assign mainImg = cmsEntity.getLocali...  [in template "20116#20152#251097" at line 35, column 5]
----
1<#-- Include common helpers --> 
2<#include "${templatesPath}/379393" /> 
3 
4 
5<#-- Get and format article publish date --> 
6<#assign displayDate = .vars['reserved-article-display-date'].data> 
7 
8<#-- Save the original page locale for later --> 
9<#assign originalLocale = locale> 
10 
11<#-- Set the page locale to the portals default locale --> 
12<#setting locale = localeUtil.getDefault()> 
13 
14<#-- Parse the date to a date object --> 
15<#assign displayDate = displayDate?datetime("EEE, d MMM yyyy HH:mm:ss Z")> 
16 
17<#assign cmsContentService= serviceLocator.findService("com.ch5finland.genelec.cms.service.CMSContentService") > 
18<#assign profileService = serviceLocator.findService("com.ch5finland.genelec.cms.service.ProfileService") > 
19 
20<#assign profile = profileService.getProfile(request) > 
21<#assign journalArticleId = .vars['reserved-article-id'].data> 
22<#assign cmsEntity = cmsContentService.getEntityByArticleId(profile, groupId, journalArticleId) > 
23 
24<#assign cmsContentFormatterService= serviceLocator.findService("com.ch5finland.genelec.cms.service.CMSContentFormatterService") > 
25 
26<#-- Article title --> 
27 
28<#if  cmsEntity.getField(profile, "/entity/fields/title")?has_content> 
29    <#assign title = cmsEntity.getLocalizedField(profile, "/entity/fields/title")> 
30<#else> 
31    <#assign title = .vars['reserved-article-title'].data> 
32</#if> 
33 
34<#if  cmsEntity.getField(profile, "/entity/assets/mainImage")?has_content> 
35    <#assign mainImg = cmsEntity.getLocalizedField(profile, "/entity/assets/mainImage")> 
36    <#if !mainImg.isNull("url")> 
37        <#assign mainImage = mainImg.url> 
38    <#else> 
39        <#assign mainImage = ""> 
40    </#if> 
41    <#if !mainImg.isNull("description")> 
42        <#assign mainImageDescription = localizeField(mainImg.description, profile.getCMSLangCode())> 
43    <#else> 
44       <#assign mainImageDescription = "">  
45    </#if> 
46</#if> 
47 
48<#--  Complete URL  --> 
49<#assign portalUrl = themeDisplay.getPortalURL() > 
50<#assign urlTitle = themeDisplay.getURLCurrent() > 
51<#assign currentURL = portalUrl + urlTitle > 
52 
53<#assign facebook_share_url = themeDisplay.getThemeSetting("facebook_share_url") > 
54<#assign linkedin_share_url = themeDisplay.getThemeSetting("linkedin_share_url") > 
55<#assign twitter_share_url = themeDisplay.getThemeSetting("twitter_share_url") > 
56 
57<@appendHTMLMetas currentURL cmsEntity "article" /> 
58 
59 
60<div class="article-page"> 
61 
62    <div class="article-page-background" style="background-image: url(${mainImage})"></div> 
63 
64    <div class="row"> 
65        <div class="col-12"> 
66            <h1 class="article-heading">${title}</h1> 
67        </div> 
68    </div> 
69 
70    <div class="row"> 
71        <div class="col-12"> 
72            <div class="article-share-buttons"> 
73 
74                <a href="${facebook_share_url}${currentURL}" target="_blank"> 
75                    <span class="fa-stack fa-md">  
76                        <i class="fas fa-circle fa-stack-2x icon-dark"></i>  
77                        <i class="fab fa-facebook-f fa-stack-1x fa-inverse"></i>  
78                    </span> 
79                </a> 
80 
81                <a href="${linkedin_share_url}${currentURL}" target="_blank"> 
82                    <span class="fa-stack fa-md">  
83                        <i class="fas fa-circle fa-stack-2x icon-dark"></i>  
84                        <i class="fab fa-linkedin-in fa-stack-1x fa-inverse"></i>  
85                    </span> 
86                </a> 
87 
88                <a href="mailto:?subject=${title}&amp;body=${title} ${currentURL}" 
89   title="${title}" target="_blank"> 
90                    <span class="fa-stack fa-md">  
91                        <i class="fas fa-circle fa-stack-2x icon-dark"></i>  
92                        <i class="fas fa-envelope fa-stack-1x fa-inverse"></i>  
93                    </span> 
94                </a> 
95                 
96                <a href="${twitter_share_url}${currentURL}" target="_blank"> 
97                    <span class="fa-stack fa-md">  
98                        <i class="fas fa-circle fa-stack-2x icon-dark"></i>  
99                        <i class="fab fa-twitter fa-stack-1x fa-inverse"></i>  
100                    </span> 
101                </a> 
102 
103            </div> 
104            <div class="article-date"> 
105                ${displayDate?string["dd.MM.yyyy"]} 
106            </div> 
107        </div> 
108    </div> 
109 
110    <div class="row article-page-main-image"> 
111        <div class="col-12"> 
112            <img class="article-image" src="${mainImage}?w=1250&fm=jpg" alt="${mainImageDescription}"> 
113        </div> 
114    </div>  
115     
116    <div class="article-section mt-5"> 
117        <div class="row"> 
118            <div class="col-xs-12 col-lg-8 col-xl-9"> 
119                <div class="product-page-intro mt-0"> 
120                    <#if  cmsEntity.getLocalizedField(profile, "/entity/fields/summary")?has_content> 
121                        ${cmsEntity.getLocalizedField(profile, "/entity/fields/summary")} 
122                    </#if> 
123                </div> 
124                <div> 
125                    <#if  cmsEntity.getLocalizedField(profile, "/entity/fields/content")?has_content> 
126                        <#--  ${cmsEntity.getLocalizedField(profile, "/entity/fields/content")}  --> 
127                        ${cmsContentFormatterService.getMarkdown(cmsEntity.getLocalizedField(profile, "/entity/fields/content"), 930)} 
128                    </#if> 
129                </div> 
130 
131                <@imageGallery cmsEntity /> 
132 
133            </div> 
134            <div class="col-xs-12 col-lg-4 col-xl-3"> 
135                 
136                <@printKitList cmsEntity /> 
137 
138                <#if cmsEntity.getField(profile, "/entity/assets/documents")?has_content> 
139                 
140                <h3>Documents</h3> 
141 
142                <ul class="list-unstyled text-bold"> 
143 
144                    <#assign documents = cmsEntity.getField(profile, "/entity/assets/documents")> 
145 
146                    <#list documents.iterator() as document> 
147                        <li><a href="${document.url}">${localizeField(document.title, profile.getCMSLangCode())}</a></li> 
148                    </#list> 
149                     
150                </ul> 
151 
152                </#if> 
153 
154            </div> 
155        </div> 
156    </div>     
157</div> 
158 
159<hr> 
160 
161<#assign entity = cmsEntity.getField(profile, "/entity") > 
162<#if !entity.relationships.isNull("products")> 
163    <#assign relatedProducts = cmsEntity.getField(profile, "/entity/relationships/products") > 
164</#if> 
165 
166<#if relatedProducts?has_content> 
167    <div class="article-bottom mt-5"> 
168        <div class="row"> 
169            <h2 class="section-heading col-xs-12 text-bolder">Related Products</h2> 
170        </div> 
171        <div class="row"> 
172            <div class="col-12"> 
173                <div class="relatedProduct-carousel owl-carousel owl-theme"> 
174                <#list relatedProducts.iterator() as relatedProduct> 
175                    <#if !relatedProduct.assets.isNull("scaleImage")> 
176                        <#assign relatedProductImage = relatedProduct.assets.scaleImage.url > 
177                        <#if cmsContentService.getLayoutForEntity(themeDisplay.layout.groupId, relatedProduct.id)?has_content> 
178                            <a href="${cmsContentService.getUrlForEntity(themeDisplay, relatedProduct.id)}"> 
179                        <#else> 
180                            <a> 
181                        </#if> 
182                            <div class="card card-img"> 
183                                <div class="aspect-ratio aspect-ratio-4-to-3"> 
184                                    <@imageThumbnail data="${relatedProductImage}" id="" cssClasses="aspect-ratio-item-fluid aspect-ratio-item-center-middle owl-lazy" thumbnail="relatedProductImg"/> 
185                                </div> 
186                                <div class="card-padding-tight text-dark"> 
187                                    <div class="text-medium text-bolder">${localizeField(relatedProduct.properties.title, profile.getCMSLangCode())}</div> 
188                                </div> 
189                            </div> 
190                        </a> 
191                    <#else> 
192                        <#if cmsContentService.getLayoutForEntity(themeDisplay.layout.groupId, relatedProduct.id)?has_content> 
193                            <a href="${cmsContentService.getUrlForEntity(themeDisplay, relatedProduct.id)}"> 
194                        <#else> 
195                            <a> 
196                        </#if> 
197                            <div class="card card-img"> 
198                                <div class="aspect-ratio aspect-ratio-4-to-3 bg-gray-lighter">   
199                                </div> 
200                                <div class="card-padding-tight text-dark"> 
201                                    <div class="text-medium text-bolder">${localizeField(relatedProduct.properties.title, profile.getCMSLangCode())}</div> 
202                                </div> 
203                            </div> 
204                        </a> 
205                    </#if> 
206                </#list> 
207                </div> 
208            </div> 
209        </div> 
210    </div> 
211</#if> 
212 
213 
214 
215<style> 
216 
217    .card{ 
218        border: 1px solid #CCC; 
219
220     
221    .card-padding-tight { 
222        padding: calc(10 / 16 * 1em); 
223        min-height: 5em; 
224
225 
226    
227    .owl-theme .owl-nav [class*='owl-']:hover { 
228        background: none; 
229        color: #000; 
230
231 
232    .owl-theme .owl-nav .disabled { 
233        opacity: 0; 
234
235 
236    .relatedProduct-carousel img { 
237        /* height defined in imageThumbnail macro */ 
238        width: auto !important; 
239
240 
241    .relatedProduct-carousel .owl-prev { 
242        width: 17px; 
243        height: 100px; 
244        position: absolute; 
245        left: -45px; 
246        top: 55px; 
247        display: block !important; 
248        border:0px solid black; 
249        font-size: 3em !important; 
250
251 
252    .relatedProduct-carousel .owl-next { 
253        width: 17px; 
254        height: 100px; 
255        position: absolute; 
256        right: -45px; 
257        top: 55px; 
258        display: block !important; 
259        border:0px solid black; 
260        font-size: 3em !important; 
261
262 
263</style> 
264 
265<script> 
266$('.relatedProduct-carousel').owlCarousel({ 
267    loop:false, 
268    nav:true, 
269    dots:false, 
270    margin:5, 
271    lazyLoad:true, 
272    navText : ['<i class="icon-angle-left">','<i class="icon-angle-right">'], 
273    responsive:{ 
274        0:{items:1, slideBy:1}, 
275        600:{items:3, slideBy:3}, 
276        1000:{items:6, slideBy:6} 
277    }, 
278}) 
279 
280</script> 
281 
282<@liferay_util["html-top"] outputKey="htmltop" > 
283    <meta property="og:image" content="test" /> 
284</@>