Solution:
Try it like this..
if( has_custom_logo() ){ the_custom_logo(); } else{ ?> <img src=" <?php echo get_template_directory_uri(); ?>/img/logo.png" alt=""> <?php }