Call to a member function buildUrl() on null

Created on 26 November 2023, 7 months 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.69.0 2024