Index: src/wp-includes/query.php
===================================================================
--- src/wp-includes/query.php	(revision 26902)
+++ src/wp-includes/query.php	(working copy)
@@ -115,7 +115,10 @@
  */
 function wp_reset_postdata() {
 	global $wp_query;
-	$wp_query->reset_postdata();
+
+	if ( isset( $wp_query ) ) {
+		$wp_query->reset_postdata();
+	}
 }
 
 /*
