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 ->get on a non-object, which causes a fatal error. Some plugins perform a 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 (probably rare, but they happen), fatal errors cause the site to die.
Use empty() instead of is_null() when checking $wp_query to cover more possible edge cases
Merge pull request #59 from cmmarslender/master

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