Template Error

Impossible to access an attribute ("locale") on a null variable.

/srv/app/drukkerijroelofs/htdocs/templates/_layouts/_master.html(47)

35                     <a href="tel:{{ topmenu.telefoonnummer }}"><img src="{{siteUrl}}dist/images/phone.svg"/>{{ topmenu.telefoonnummer }}</a>
36                     <a href="mailto:{{ topmenu.mail }}"><img src="{{siteUrl}}dist/images/email.svg"/>{{ topmenu.mail }}</a>
37                     {% block locale__switch %}
38 
39                     {# Loop through all of the site locales, except the current one #}
40                     {% set otherLocales = craft.i18n.getSiteLocaleIds()|without(craft.locale) %}
41                     {% for locale in otherLocales %}
42 
43                     {# Find the current entry in the other locale #}
44                     {% set localeEntry = craft.entries.id(entry.id).locale(locale).first %}
45 
46                     {# Make sure that it's actually localized to this locale #}
47                     {% if localeEntry.locale == locale %}
48                     <span class="text-uppercase ml-4 active language">
49                             {{ craft.locale }} -
50                         </span>
51 
52                     {# Output a link to it #}
53                     <a href="{{ localeEntry.getUrl() }}" class="text-uppercase language">{{ locale }}</a>
54                     {% else %}
55 
56                     {# Output a link to the hompage #}
57                     <a href="{{ craft.config.siteUrl[locale] }}" class="text-uppercase language">{{ locale }}</a>
58                     {% endif %}
59 
2024-03-28 20:56:23 Apache / Craft CMS 2.9.2