Check if the global $wp_query is null before using get_query_var....

If wp_query is null, then get_query_var is trying to call $wp_query->get on a non-object, which causes a fatal error. 

Some plugins setup a new WP_Query on the 'plugins_loaded' action, which looking in wp-settings.php is called before the global $wp_query object is set up. In cases like this, the fatal error just makes the site die.