Prevent possible fatal error when user holds edit lock for a deleted order (#39497)
* Prevent possible fatal error when locked order is deleted * Add changelog
This commit is contained in:
parent
62645e0ba8
commit
14d9760549
|
@ -0,0 +1,4 @@
|
|||
Significance: patch
|
||||
Type: fix
|
||||
|
||||
Prevent possible fatal error when edit lock is held on deleted order.
|
|
@ -100,7 +100,7 @@ class EditLock {
|
|||
}
|
||||
|
||||
$order = wc_get_order( $order_id );
|
||||
if ( ! current_user_can( get_post_type_object( $order->get_type() )->cap->edit_post, $order->get_id() ) && ! current_user_can( 'manage_woocommerce' ) ) {
|
||||
if ( ! $order || ( ! current_user_can( get_post_type_object( $order->get_type() )->cap->edit_post, $order->get_id() ) && ! current_user_can( 'manage_woocommerce' ) ) ) {
|
||||
return $response;
|
||||
}
|
||||
|
||||
|
|
Loading…
Reference in New Issue