If $wp_query->post_count == 0
I cant see how $wpdb->get_results( $wp_query->request )
would return any posts. So basically
$request = $wpdb->get_results( $wp_query->request );
contains nothing and $request[0]
doesn’t exist.
Ergo
PHP Notice: Undefined offset: 0
It would be interesting to know, what this could is supposed to achieve.