An error occurred while processing the template.
?substring(...) expects a number as argument #1, but received a Null.

----
FTL stack trace ("~" means nesting-related):
	- Failed at: #assign yturl2 = yturl?substring(index)  [in template "20302#20342#NEWS_RELEASE_DETAIL" at line 96, column 9]
----
1<#assign _dlfels = serviceLocator.findService("com.liferay.document.library.kernel.service.DLFileEntryLocalService") /> 
2 
3<#-- set a boolean to determine if we should show the hero at all based on flag set in structure --> 
4<#-- Optimized through discussion https://chatgpt.com/share/684f45a6-1118-8004-9d2a-6f0607678a31 --> 
5<#assign hideHeroVal = Hide_hero_image_on_detail_page.getData()> 
6<#assign showHero = !(hideHeroVal?has_content && hideHeroVal == "1")> 
7 
8 
9<#-- set the default image and alt text --> 
10<#assign imgSrc = Image.getData() > 
11<#assign imgAltText = Content.getData() > 
12<#-- sets Alternate image --> 
13<#assign altImgSrc = Alternate_Hero_Image.getData() > 
14<#assign altImgAltText = Content.getData() > 
15 
16<#-- try to set more advanced options of image display --> 
17<#-- set the base hostname url for environment (local/qa/stg/prod) --> 
18<#assign imageBaseUri = ui_config.getCdnCgiUri() > 
19<#-- determine if we want to use CDN Image Optimizations or not --> 
20<#if ui_config.getUseCdnImageOptimizations() > 
21<#-- set the instructions to use for optimizing the image(s) in this item --> 
22    <#assign instructionPath = "/cdn-cgi/image/q=50" > 
23    <#if !getterUtil.getBoolean(By_pass_Cloudflare_optimization.getData())> 
24        <#assign imageBaseUri = imageBaseUri + instructionPath > 
25    </#if> 
26</#if> 
27 
28<#assign treePath = group_util.getGroupFriendlyUrlTreePath(groupId) > 
29 
30<#assign imageAttributes = jsonFactoryUtil.createJSONObject(Image.getAttributes()) > 
31 
32<#if (imageAttributes.fileEntryId??) > 
33    <#assign fileEntryId = imageAttributes.fileEntryId?number > 
34    <#if fileEntryId??> 
35        <#assign fe = _dlfels.getFileEntry(fileEntryId)> 
36        <#if fe??> 
37            <#assign imgSrc = imageBaseUri + "/documents/" + fe.repositoryId +"/"  + fe.fileEntryId + "/" + fe.fileName + "/" + fe.uuid + "?t=" + fe.modifiedDate?long > 
38            <#if imageAttributes.alt?has_content> 
39                <#assign imgAltText = imageAttributes.alt > 
40            <#else> 
41                <#assign imgAltText = imgAltText?replace('<[^>]+>','','r') > 
42            </#if> 
43        </#if> 
44    </#if> 
45</#if> 
46 
47<#assign 
48    useAltImage = false, 
49    altImageAttributes = jsonFactoryUtil.createJSONObject(Alternate_Hero_Image.getAttributes()) > 
50<#if (altImageAttributes.fileEntryId??) > 
51    <#assign altFileEntryId = altImageAttributes.fileEntryId?number > 
52    <#if altFileEntryId??> 
53        <#assign fe = _dlfels.getFileEntry(altFileEntryId)> 
54        <#if fe??> 
55            <#assign 
56                useAltImage = true, 
57                altImgSrc = imageBaseUri + "/documents/" + fe.repositoryId +"/"  + fe.fileEntryId + "/" + fe.fileName + "/" + fe.uuid + "?t=" + fe.modifiedDate?long > 
58            <#if altImageAttributes.alt?has_content> 
59                <#assign altImgAltText = altImageAttributes.alt > 
60            <#else> 
61                <#assign altImgAltText = altImgAltText?replace('<[^>]+>','','r') > 
62            </#if> 
63        </#if> 
64    </#if> 
65</#if> 
66 
67<!-- handle the video URL logic if present --> 
68<!-- this section has room for optimization --> 
69<#assign useVideo = false> 
70<#if validator.isNotNull(Youtube_Video_Hero_.getData()) > 
71    <#assign yturl = Youtube_Video_Hero_.getData()> 
72<#else> 
73    <#assign yturl = ''> 
74</#if> 
75<#if validator.isNotNull(Youtube_Video_Hero_.getData()) > 
76    <#assign 
77        useVideo = true, 
78        isVimeo = "false"> 
79    <#assign yturl = Youtube_Video_Hero_.getData()> 
80    <#if yturl?contains("https://youtu.be/")> 
81        <#assign index = yturl?index_of('https://youtu.be/')> 
82        <#assign index = index + 17> 
83    </#if> 
84    <#if yturl?contains("https://www.youtube.com/watch?v=")> 
85        <#assign index = yturl?index_of('https://www.youtube.com/watch?v=')> 
86        <#assign index = index + 32> 
87    </#if> 
88 
89    <#if yturl?contains("https://vimeo.com/")> 
90        <#assign isVimeo = "true"> 
91        <#assign index = yturl?remove_beginning("https://vimeo.com/")> 
92        <#assign videoEmbedCode = "https://player.vimeo.com/video/" + index> 
93        <#assign yturl2 = videoEmbedCode> 
94        <#assign linkURL = yturl> 
95    <#else> 
96        <#assign yturl2 = yturl?substring(index)> 
97        <#assign linkURL = "https://www.youtube.com/embed/${yturl2}?rel=0&amp;showinfo=0&amp;autoplay=1"> 
98    </#if> 
99</#if> 
100 
101<#assign displayDate = .vars['reserved-article-display-date'].data> 
102<#setting time_zone = languageUtil.get(locale, "template-timezone")> 
103<#assign originalLocale = locale> 
104<#setting locale = localeUtil.getDefault()> 
105<#assign displayDate = displayDate?date("EEE, d MMM yyyy HH:mm:ss Z")> 
106<#setting locale = originalLocale> 
107<#assign displayDate = displayDate?string("long")> 
108 
109 
110 
111<style> 
112    .ay-news-release__content{ 
113        min-height:150px; 
114
115    /*displays bios on one row if there's room */ 
116    #ay .ay-news-release__content .contact-group { 
117        display:flex; 
118        flex-justify:start; 
119        flex-wrap:wrap; 
120
121    /*Keeps the ay-bio from smooshing width-wise.*/ 
122    #ay .ay-news-release__content .ay-bio { 
123        min-width:240px; 
124
125    /* added the white on hover because the primary button is supposed to have white text, but it has light blue so the text disappears on hover. */ 
126    #ay .ay-button__primary:hover { 
127        color:#FFF; 
128
129</style> 
130 
131<div class="ay-news-release"> 
132    <h1 id="ay-artTitle" class="h2">${Content.getData()}</h1> 
133 
134    <#assign 
135        useImage = showHero && !useVideo, 
136        finalImgSrc = imgSrc, 
137        finalImgAltText = imgAltText, 
138        imgStyle = "" 
139
140 
141    <#if useImage && showHero> 
142        <#if useAltImage> 
143            <#assign 
144                finalImgSrc = altImgSrc, 
145                finalImgAltText = altImgAltText, 
146                imgStyle = 'style="max-height: none;"' 
147
148        </#if> 
149        <img src="${finalImgSrc}" alt="${finalImgAltText}" ${imgStyle}> 
150    </#if> 
151 
152 
153 
154    <#if validator.isNotNull(Youtube_Video_Hero_.getData()) > 
155 
156        <div class="ay-video-firefox-extra-wrap"> 
157            <div class="ay-video-wrapper"> 
158                <#if Image.getData()?has_content> 
159                    <a href="${linkURL}" target="youtubevideo" style="background:url('${Image.getData()}') no-repeat center center; background-size:cover;"></a> 
160                </#if> 
161                <div class="<#if isVimeo == 'true'>ytv-container<#else>yt-container ytv-container</#if>" video="${yturl2}"> 
162                    <#if isVimeo == "true"> 
163                        <iframe id="youtubeiframe" name="youtubevideo" width="1280" height="720" src="${videoEmbedCode}" frameborder="0" allow="autoplay; fullscreen" allowfullscreen></iframe> 
164                    </#if> 
165                </div> 
166                <#if isVimeo == "true"> 
167                    <script src="https://player.vimeo.com/api/player.js"></script> 
168                    <script>const player = new Vimeo.Player("youtubeiframe");</script> 
169                </#if> 
170                <script> 
171                    $(document).ready(function(){ 
172                        $(".ay-video-wrapper a").bind("click",function(event){ 
173                            <#if isVimeo == "true"> 
174                            event.preventDefault(); 
175                            $(this).next().children().css({visibility:'visible'}); 
176                            player.play(); 
177                            <#else> 
178                            $(this).next().children().css({visibility:'visible'}); 
179                            </#if> 
180                            if($(".cc-window").hasClass("cc-invisible") == true){ 
181                                if($(".yt-container").html() != ""){ 
182                                    $(this).css({display:'none'}); 
183                                    <#if isVimeo == "false"> 
184                                    $(this).next().children().css({visibility:'visible'}).click(); 
185                                    </#if> 
186
187                            }else{ 
188                                event.preventDefault(); 
189
190                        }); 
191                    }); 
192                </script> 
193            </div> 
194        </div> 
195    </#if> 
196 
197    <small>${displayDate}</small> 
198    <div class="ay-news-release__content"> 
199        <#if SubTitle.getData()?has_content> 
200            <h3 class="ay-news-release__subtitle">${SubTitle.getData()}</h3> 
201        </#if> 
202        ${News_Release_Detail_Content.getData()} 
203        <#if Boiler_Plate_Content.getData()?has_content > 
204            <div class="ay-news-release__boiler"> 
205                ${Boiler_Plate_Content.getData()} 
206            </div> 
207        </#if> 
208        <div class="ay-news-release__social"> 
209            <a id="ay-email-to" href="#" target="_blank" class="ay-news-release__social--item"> 
210                <svg class="ay-news-release__social--icon"> 
211                    <use xlink:href="/o/ay-theme/resources/images/images.svg#email" /> 
212                </svg> 
213            </a> 
214            <a id="ay-social-twitter" href="#" class="ay-news-release__social--item" target="_blank"> 
215                <svg class="ay-news-release__social--icon" xmlns="http://www.w3.org/2000/svg" id="Layer_1" data-name="Layer 1" viewBox="0 0 150 150" style="enable-background:new 0 0 150 150;"> 
216                    <defs> 
217                        <style> 
218                            .cls-1 { 
219                                fill: #000; 
220                                stroke-width: 0px; 
221
222                        </style> 
223                    </defs> 
224                    <path fill="#000" class="cls-1" d="m85.89,109.23h22.79l-25.62-41.4,19.49-25.09h0l4.68-6h-8.9l-19.21,24.74-15.03-24.27h-22.79l25.12,40.59-24.05,30.97h8.9l4.68-6h0l14.46-18.58,15.53,25.09-.06-.03Zm-25.15-66.02l37.16,60.01h-8.65l-37.16-60.01s8.65,0,8.65,0Zm89.26,31.78c0,41.42-33.58,75-75,75S0,116.42,0,75,33.58,0,75,0s75,33.58,75,75Z"/> 
225                </svg> 
226            </a> 
227            <a id="ay-social-facebook" href="#" class="ay-news-release__social--item" target="_blank"> 
228                <svg class="ay-news-release__social--icon"> 
229                    <use xlink:href="/o/ay-theme/resources/images/images.svg#facebook" /> 
230                </svg> 
231            </a> 
232            <a id="ay-social-linkedin" href="#" class="ay-news-release__social--item" target="_blank"> 
233                <svg class="ay-news-release__social--icon"> 
234                    <use xlink:href="/o/ay-theme/resources/images/images.svg#linkedin1" /> 
235                </svg> 
236            </a> 
237            <#if treePath?contains("/ay/de/") > 
238                <a id="ay-social-xming" href="#" class="ay-news-release__social--item" target="_blank"> 
239                    <svg class="ay-news-release__social--icon"> 
240                        <use xlink:href="/o/ay-theme/resources/images/images.svg#xing-social" /> 
241                    </svg> 
242                </a> 
243            </#if> 
244        </div> 
245    </div> 
246</div> 
247<#assign newsTitle = Content.getData() /> 
248 
249<script> 
250    function socialLinks(){ 
251        uri=window.location; 
252        uri=uri.toString(); 
253        ofLoc=$(".ay-header-options h3 a").html(); 
254        enc=encodeURIComponent(uri); 
255        prtitle=$("#ay-artTitle").html(); 
256        //prtitle=prtitle.replace(/(\r\n\t|\n|\r\t)/gm,""); 
257        prtitle=encodeURI(prtitle); 
258        mailtoSub="Avison Young - "+ofLoc+" News: "; 
259        mailtoSub=encodeURI(mailtoSub); 
260        //alert(enc); 
261        $("#ay-social-twitter").attr("href","https://twitter.com/intent/tweet?url="+enc+"&amp;text="+prtitle+"&amp;via=AvisonYoung"); 
262        $("#ay-social-facebook").attr("href","https://www.facebook.com/sharer/sharer.php?u="+enc); 
263        $("#ay-social-linkedin").attr("href","https://www.linkedin.com/cws/share?url="+enc); 
264        <#if treePath?contains("/ay/de/") > 
265        $("#ay-social-xming").attr("href","https://www.xing.com/spi/shares/new?url="+enc); 
266        </#if> 
267        $("#ay-email-to").attr("href","mailto:?subject="+mailtoSub+prtitle+"&body="+enc); 
268
269    $(document).ready(function(){ 
270        socialLinks(); 
271    }) 
272</script>