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

Merges [25932] to the 3.9 branch.

props SergeyBiryukov.
fixes #26775.

Built from https://develop.svn.wordpress.org/branches/3.8@26951


git-svn-id: http://core.svn.wordpress.org/branches/3.8@26830 1a063a9b-81f0-0310-95a4-ce76da25c4cd