Fix fatal error on /my-account/view-order/ endpoint

When no order number is set this causes a fatal error. This check for
the $order object should be sufficient.

Closes #7301
This commit is contained in:
Bryce 2015-02-05 12:55:33 +07:00
parent 8f4c1e184f
commit 888622a621
1 changed files with 2 additions and 2 deletions

View File

@ -3,7 +3,7 @@
* Contains the query functions for WooCommerce which alter the front-end post queries and loops.
*
* @class WC_Query
* @version 1.6.4
* @version 2.3.0
* @package WooCommerce/Classes
* @category Class
* @author WooThemes
@ -113,7 +113,7 @@ class WC_Query {
break;
case 'view-order' :
$order = wc_get_order( $wp->query_vars['view-order'] );
$title = sprintf( __( 'Order %s', 'woocommerce' ), _x( '#', 'hash before order number', 'woocommerce' ) . $order->get_order_number() );
$title = ( $order ) ? sprintf( __( 'Order %s', 'woocommerce' ), _x( '#', 'hash before order number', 'woocommerce' ) . $order->get_order_number() ) : '';
break;
case 'edit-account' :
$title = __( 'Edit Account Details', 'woocommerce' );