Problem/Motivation
It's possible for the $settings['responsive_image_style']
value to be an empty string, meaning this check:
if (isset($settings['responsive_image_style'])) {
// Try to determine image style based on responsive image style.
/** @var \Drupal\responsive_image\Entity\ResponsiveImageStyle $responsive_image_style */
$responsive_image_style = ResponsiveImageStyle::load($settings['responsive_image_style']);
Doesn't work, and it tries to load an empty string as a ResponsiveImageStyle, throwing the following error:
Error: Call to a member function getImageStyleMappings() on null in Drupal\contextual_image_widget_crop\Plugin\Field\FieldWidget\ContextualImageCropMediaLibraryWidget->getImageStyles() (line 160 of ~/web/modules/contrib/contextual_image_widget_crop/src/Plugin/Field/FieldWidget/ContextualImageCropMediaLibraryWidget.php).
Steps to reproduce
Not entirely sure, I messed with the display settings a bit but couldn't find a stable way to reproduce. It does happen sometimes..
Proposed resolution
Change `isset` to `!empty`, which will cover all cases (null, empty string, non-existent, ..)
Remaining tasks
I'll create a MR that applies the fix.