Call to a member function getCode() on null

Created on 10 January 2024, about 1 year ago

This line caused a NULL pointer exception for a client when they tried to capture a Vipps payment: https://git.drupalcode.org/project/commerce_vipps/-/blob/8.x-4.x/src/Plu...

Because the code failed there the exception from Vipps was never logged so I don't know what it was, but it's clear from the API that $exception->getError() can return NULL, so the code needs to be rewritten so that it ensures we have an error before trying to read it's error code.

My assumption is that not having an error is the same as having the wrong error code.

I'll attach a patch with my proposed change shortly.

🐛 Bug report
Status

Needs review

Version

4.0

Component

Code

Created by

🇳🇴Norway TwiiK Trondheim

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

Comments & Activities

Production build 0.71.5 2024