I have a block on a commerce product page, this block displays the product entity with a specific display set up to just show the map. After the recent updates, when the product has no locations, I get a PHP error:
Fatal error: Call to a member function getValue() on null in web/modules/contrib/geolocation/modules/geolocation_google_maps/src/Plugin/Field/FieldFormatter/GeolocationGoogleMapFormatter.php on line 75
Basically this bit of code doesn't properly check that an element exists when trying to render:
if (
$settings['use_overridden_map_settings']
&& !empty($items->get(0)->getValue()['data'][$this->mapProviderSettingsFormId])
&& is_array($items->get(0)->getValue()['data'][$this->mapProviderSettingsFormId])
)
Comments
Comment #2
willeaton commentedPatch attached with possible fix.
Comment #4
willeaton commentedOK, patch now created from main module root rather than sub module root
Comment #5
willeaton commentedUpdating status to test patch again
Comment #7
christianadamski commentedYour patch failes, because you wrote against beta-1 instead of -dev
Comment #8
christianadamski commentedComment #10
christianadamski commentedThanks Will.