Set the background to a default image if there isn’t a specified “featured image”

I found the solution from a WordPress forum and this is what they used. Works perfect

 <?php if (has_post_thumbnail( $post->ID ) ): ?>
 <?php $image = wp_get_attachment_image_src( get_post_thumbnail_id( $post->ID ), '' );
 $image = $image[0]; ?>
 <?php else :
 $image = get_bloginfo('stylesheet_directory') . '/lib/images/home1-1024x681.jpg'; ?>
 <?php endif; ?>
 <section id="halfpro" style="background-image: url('<?php echo $image; ?>')" >