Call to a member function buildUrl() on null

Created on 26 November 2023, about 1 year ago

Problem/Motivation

Calling Twig function styled_image_url or ResponsiveImageStylesTwigExtension::getStyledImageUrl with an inexisting style name causes the following error:

Error: Call to a member function buildUrl() on null in Drupal\pagedesigner_responsive_images\ResponsiveImageStylesTwigExtension->getStyledImageUrl() (line 143 of modules/contrib/pagedesigner_responsive_images/src/ResponsiveImageStylesTwigExtension.php).

Proposed resolution

To reduce the risk of fatal errors in production, return the default url if style does not exist.

Remaining tasks

Review MR

User interface changes

None

API changes

ResponsiveImageStylesTwigExtension::getStyledImageUrl will return default image url if style does not exist.

Data model changes

None

🐛 Bug report
Status

Fixed

Version

3.0

Component

Code

Created by

🇨🇭Switzerland pvbergen

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

Merge Requests

Comments & Activities

Production build 0.71.5 2024