Call to a member function getValue() on null in lazy_preprocess_field

Created on 9 March 2022, over 2 years ago
Updated 1 April 2024, 3 months ago

Problem/Motivation

Lazy is throwing the following fatal error on pages where the preprocessor is run, on an item that is not an (Media) Entity Reference.
Call to a member function getValue() on null in lazy_preprocess_field

Steps to reproduce

Enable the module and create a field with Lazy Loading enabled.
Now enter a SVG in that field, that is saved as an URL instead of a Media Item/Reference

Proposed resolution

We should check if the `#item` key in the preprocessor is available.
If not, we can assume that no target_id is available, so we can skip the processing.

Remaining tasks

Add an extra condition before using any #item values, like in the patch.

πŸ› Bug report
Status

RTBC

Version

3.0

Component

Code

Created by

πŸ‡³πŸ‡±Netherlands dennisdk

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.69.0 2024