How to print the thumbnail only if a post has a thumbnail

Try this inside else condition where no image assigned.

    if (has_post_thumbnail()) {
    ?><a href="https://wordpress.stackexchange.com/questions/257634/<?php the_post_thumbnail_url(); ?>">
    <?php the_post_thumbnail();?>
    </a><?php
} else {
    echo '<figure><a href="add_link_here"><img src="'.get_bloginfo("stylesheet_directory").'/images/stone.jpg" /></figure></a>';
}