Change if-condition from $query->found_posts to $query->posts

$query->found_posts may be true even if $query->posts has no items