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:
parent
3089b1888e
commit
c0424210ab
|
@ -0,0 +1,4 @@
|
|||
Significance: patch
|
||||
Type: fix
|
||||
|
||||
Add safety check to prevent rare occurences of a fatal in WooSubscriptionsNotes
|
|
@ -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' ) ) {
|
||||
|
|
Loading…
Reference in New Issue