Verify order was found

Verify the order was found before evaluating the user_id on the $order object. Would previously throw an error if attempting to view an invalid order number.
This commit is contained in:
nickrouty 2015-04-14 15:16:34 -07:00
parent 1e06f82f59
commit 0f88f6386b
1 changed files with 1 additions and 1 deletions

View File

@ -277,7 +277,7 @@ function wc_customer_has_capability( $allcaps, $caps, $args ) {
$user_id = $args[1];
$order = wc_get_order( $args[2] );
if ( $user_id == $order->user_id ) {
if ( $order && $user_id == $order->user_id ) {
$allcaps['view_order'] = true;
}
break;