Call to a member function getFilename() on null in ImageFieldBuilder->build()

Created on 29 June 2020, about 4 years ago
Updated 17 April 2024, 5 months ago

When doing (partial) D7->D8 migrations content nodes sometimes come across with bits temporarily missing. Like images.
The missing image may be the only thing wrong with the node.

When the Diff function is applied on revisions of a node with a "not-yet migrated image" a fatal exception is thrown:

The website encountered an unexpected error.
Error: Call to a member function getFilename() on null in Drupal\diff\Plugin\diff\Field\ImageFieldBuilder->build()
(line 38 of modules/contrib/diff/src/Plugin/diff/Field/ImageFieldBuilder.php).

The patch below implements two small defensive code snippets to get over the hump so that the content's revisions can still be compared (except for the missing image, of course).

πŸ› Bug report
Status

Needs review

Version

1.0

Component

Code

Created by

πŸ‡¦πŸ‡ΊAustralia RdeBoer Melbourne

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