Check that PPEC settings is not null

This commit is contained in:
Alex P 2021-11-15 16:12:54 +02:00
parent d31b3719e3
commit 01942b6699
2 changed files with 9 additions and 48 deletions

View file

@ -44,7 +44,12 @@ class PPECHelper {
* @return bool
*/
public static function is_gateway_available() {
return self::is_plugin_active() && is_callable( 'wc_gateway_ppec' ) && wc_gateway_ppec()->settings->get_active_api_credentials();
if ( ! self::is_plugin_active() || ! is_callable( 'wc_gateway_ppec' ) ) {
return false;
}
$ppec = wc_gateway_ppec();
return is_object( $ppec ) && $ppec->settings && $ppec->settings->get_active_api_credentials();
}
/**