->getname() is called on $link['language'] = NULL

Created on 19 February 2022, almost 3 years ago
Updated 2 April 2023, over 1 year ago

I configured the block to use "native name"

This caused the following error:
[19-Feb-2022 04:30:07] Error: Call to a member function getName() on null in C:\wamp64\www\***\web\modules\contrib\dropdown_language\src\Plugin\Block\DropdownLanguage.php on line 176 #0 C:\wamp64\www\***\web\core\modules\block\src\BlockViewBuilder.php(171): Drupal\dropdown_language\Plugin\Block\DropdownLanguage->build()

adding a Null check on link[language] at line 176 solved the issue:
if($link['language'] != Null) { $name = $link['language']->getName(); }

🐛 Bug report
Status

Closed: duplicate

Version

3.0

Component

Code

Created by

Live updates comments and jobs are added and updated live.
Sign in to follow issues

Comments & Activities

Not all content is available!

It's likely this issue predates Contrib.social: some issue and comment data are missing.

Production build 0.71.5 2024