Skip to content

Commit a222fb6

Browse files
authored
Check for undefined params before using (#5234)
1 parent 24ffea5 commit a222fb6

File tree

2 files changed

+9
-1
lines changed

2 files changed

+9
-1
lines changed

changelog/fix-woopay-params-undefined

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,4 @@
1+
Significance: patch
2+
Type: fix
3+
4+
Fix an undefined variable bug in WooPay Express Checkout.

client/checkout/platform-checkout/express-button/utils.js

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4,8 +4,12 @@
44
* Retrieves a configuration value.
55
*
66
* @param {string} name The name of the config parameter.
7-
* @return {*} The value of the parameter of null.
7+
* @return {*} The value of the parameter or undefined.
88
*/
99
export const getWooPayExpressData = ( name ) => {
10+
if ( 'undefined' === typeof wcpayWooPayExpressParams ) {
11+
return undefined;
12+
}
13+
1014
return wcpayWooPayExpressParams?.[ name ];
1115
};

0 commit comments

Comments
 (0)