Add safety check for rare fatal case with subscription note (#46472)

* Add safety check for rare fatal case

* Change to is_object check
This commit is contained in:
louwie17 2024-04-17 07:05:34 -03:00 committed by GitHub
parent 3089b1888e
commit c0424210ab
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
2 changed files with 7 additions and 0 deletions

View File

@ -0,0 +1,4 @@
Significance: patch
Type: fix
Add safety check to prevent rare occurences of a fatal in WooSubscriptionsNotes

View File

@ -221,6 +221,9 @@ class WooSubscriptionsNotes {
* @return int|false
*/
public function get_product_id_from_subscription_note( &$note ) {
if ( ! is_object( $note ) ) {
return false;
}
$content_data = $note->get_content_data();
if ( property_exists( $content_data, 'product_id' ) ) {