Avoid a fatal error in wp_reset_postdata() if $wp_query global is not set.

see #26775 for trunk.

git-svn-id: https://develop.svn.wordpress.org/trunk@26932 602fd350-edb4-49c9-b593-d223f7449a82