Link on post title only if post have content

Based on this question

Probably the easiest way would be:

// The Loop
while (have_posts()) : the_post(); ?>

    <?php if ('' !== get_post()->post_content): ?>
        <h2><a href="<?php the_permalink() ?>" rel="bookmark"
               title="Permanent Link to <?php the_title_attribute(); ?>"><?php the_title(); ?></a></h2>
    <?php else: ?>
        <h2><?php the_title(); ?></h2>
    <?php endif; ?>
            <?php if (get_field('telefono')): ?>Telefono: <?php the_field('telefono'); ?>
            <?php endif; ?>

            <?php if (get_field('email')): ?> Email <?php the_field('email'); ?>
            <?php endif; ?>
            <?php if (get_field('indirizzo')): ?> Indirizzo: <?php the_field('indirizzo'); ?>
            <?php endif; ?>
            <?php if (get_field('link_mappa')): ?>
                <a href="<?php the_field('link_mappa'); ?>" target="_blank" rel="noopener noreferrer"> <img
                            src="" width="250"/></a>
            <?php endif; ?>

<?php endwhile;

else: ?>
    <p>Sorry, no posts matched your criteria.</p>

<?php endif; ?>

<?php get_sidebar(); ?>
<?php get_footer(); ?>