GiftcardOrderCurrencyValidator assumes that balance is always present

Created on 4 December 2024, 6 months ago

Problem/Motivation

GiftcardOrderCurrencyValidator assumes that balance is always present. Hence, when the value is not present, it throws the following error: Error: Call to a member function getCurrencyCode() on null in Drupal\commerce_giftcard\Plugin\Validation\Constraint\GiftcardOrderCurrencyValidator->validate() (line 29 of /code/web/modules/contrib/commerce_giftcard/src/Plugin/Validation/Constraint/GiftcardOrderCurrencyValidator.php).

Would be great to add some defensive code to avoid this exception.

Proposed resolution

Add defensive code.

Remaining tasks

User interface changes

API changes

Data model changes

🐛 Bug report
Status

Active

Version

1.0

Component

Code

Created by

🇪🇸Spain plopesc Valladolid

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