Skip to content

Commit 3969630

Browse files
authored
Merge pull request #1337 from Automattic/fix/1336-ppec-crash
Fixed the page crash when PPEC has not initialized successfully
2 parents 59953fd + c56b702 commit 3969630

File tree

1 file changed

+6
-1
lines changed

1 file changed

+6
-1
lines changed

classes/class-wc-connect-paypal-ec.php

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -38,11 +38,16 @@ public function init() {
3838
return;
3939
}
4040

41+
$ppec_plugin = wc_gateway_ppec();
42+
if ( ! property_exists( $ppec_plugin, 'settings' ) || empty( $ppec_plugin->settings ) ) {
43+
return;
44+
}
45+
4146
$this->maybe_set_reroute_requests();
4247

4348
add_filter( 'woocommerce_paypal_express_checkout_settings', array( $this, 'adjust_form_fields' ) );
4449
$this->initialize_settings();
45-
$settings = wc_gateway_ppec()->settings;
50+
$settings = $ppec_plugin->settings;
4651

4752
// Don't modify any PPEC plugin behavior if WCS request proxying is not enabled
4853
if ( 'yes' !== $settings->reroute_requests ) {

0 commit comments

Comments
 (0)