In multilingual_menu_urls_preprocess_menu(), it's possible for loadEntityByUuid() to return null, but $entity is assumed to be non-null on the next line.

I haven't isolated the particular circumstances which can cause $entity to be null, but have seen the issue in practice.

I'll attach a patch shortly.

CommentFileSizeAuthor
#2 null-entity-check-2978430-2.patch841 bytesiansholtys

Comments

iansholtys created an issue. See original summary.

iansholtys’s picture

Status: Active » Needs review
StatusFileSize
new841 bytes

Attaching a patch which should take care of it.

umberto.’s picture

The patch works great for me, solve the error:

Error: Call to a member function hasTranslation() on null in multilingual_menu_urls_preprocess_menu() (line 137

thanks

GilAnder’s picture

This patch also worked for me.
Thx.

mlecha’s picture

Huge thanks for the patch in #2. I had the non-default language on a multilanguage site produce the white screen of death in admin mode.

Error: Call to a member function hasTranslation() on null in C:\\sites\\rwarts\\drupal\\modules\\multilingual_menu_urls\\multilingual_menu_urls.module on line 137 #0

It was the module admin_toolbar. Uninstalling admin_toolbar_tools with a cache clear was a temporary fix.

Please commit the patch..

Thank you!

smulvih2’s picture

Patch #2 fixed the issue for me.

geoanders’s picture

Version: 8.x-1.0-alpha1 » 8.x-1.x-dev
Status: Needs review » Fixed

Status: Fixed » Closed (fixed)

Automatically closed - issue fixed for 2 weeks with no activity.