Skip to content

Call to a member function get() on null in 'optimole-wp/inc/lazyload_replacer.php:118' #1020

@jhned

Description

@jhned

Description

Full stack trace:

 in Optml_Lazyload_Replacer::get_background_lazyload_selectors called at /wp-content/plugins/optimole-wp/inc/rest.php (969)
 in Optml_Rest::optimizations called at /wp-includes/rest-api/class-wp-rest-server.php (1292)
 in WP_REST_Server::respond_to_request called at /wp-includes/rest-api/class-wp-rest-server.php (1125)
 in WP_REST_Server::dispatch called at /wp-includes/rest-api/class-wp-rest-server.php (439)
 in WP_REST_Server::serve_request called at /wp-includes/rest-api.php (459)
 in rest_api_loaded called at /wp-includes/class-wp-hook.php (324)
 in WP_Hook::apply_filters called at /wp-includes/class-wp-hook.php (348)
 in WP_Hook::do_action called at /wp-includes/plugin.php (565)
 in do_action_ref_array called at /wp-includes/class-wp.php (418)
 in WP::parse_request called at /wp-includes/class-wp.php (818)
 in WP::main called at /wp-includes/functions.php (1342)
 in wp called at /wp-blog-header.php (16)
 in require called at /index.php (17)
if ( self::instance()->settings->get( 'bg_replacer' ) === 'disabled' ) {
	self::$background_lazyload_selectors = [];
	return self::$background_lazyload_selectors;
}

Seems like self::instance()->settings is null, and the get call fails.

Step-by-step reproduction instructions

This happens intermittently on a REST API call to the /wp-json/optml/v1/optimizations endpoint.

Screenshots, screen recording, code snippet or Help Scout ticket

No response

Environment info

No response

Is the issue you are reporting a regression

No

Metadata

Metadata

Assignees

No one assigned

    Labels

    bugThis label could be used to identify issues that are caused by a defect in the product.

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions