Showing author page if user has no post

<?php 
        $curauth = (isset($_GET['author_name'])) ? get_user_by('slug', $author_name) : get_userdata(intval($author)); 
        ?>
        <?php if ( have_posts() ) ?>
        <h2>Posts by <?php echo $curauth->nickname; ?>:</h2>
            <ul>
            <?php if ( have_posts() ) : while ( have_posts() ) : the_post(); ?>
                <li>
                    <a href="https://wordpress.stackexchange.com/questions/106902/<?php the_permalink() ?>" rel="bookmark" title="Permanent Link: <?php the_title(); ?>">
                    <?php the_title(); ?></a>,
                    <?php the_time('d M Y'); ?> in <?php the_category('&');?>
                </li>
            <?php endwhile; else: ?>
                <p><?php _e('No posts by this author.'); ?></p>
            <?php endif; ?>
            </ul>
    <?php
        $args = array(
            'user_id' => $curauth->ID,
            'number' => 10, // how many comments to retrieve
            'status' => 'approve'
            );

        $comments = get_comments( $args );

        if ( $comments )
        {
            $output.= "<ul>";
            foreach ( $comments as $c )
            {
            $output.= '<li>';
            $output.= '<a href="'.get_comment_link( $c->comment_ID ).'">';
            $output.= get_the_title($c->comment_post_ID);
            $output.= '</a>';
            $output.= "</li>\n";
            }
            $output.= '</ul>';

            echo $output;
        } else { 
            echo "bla";
        }
?>

Modified from here.

Edit: Added OP’s code