Bail out of loading buddypress-functions.php if $wp_query is not set

When $wp_query is not set, it means either that the main query has not run,
or that it has been somehow wiped out. Having an empty $wp_query global causes
problems in load_template() (used to load buddypress-functions.php()) because
of the way load_template() populates certain global variables from $wp_query.

An empty $wp_query global should not happen during normal page loads, but does
happen sometimes during unit testing, when globals are directly manipulated by
the bootstrap.

git-svn-id: https://buddypress.svn.wordpress.org/trunk@7508 cdf35c40-ae34-48e0-9cc9-0c9da1808c22