You can add this if statement to the PHP file. Then it won’t echo the <h2> part at all in less there is a title.
if(get_the_title() != ""){
$slider .= '<h2 class="slide-title"><a>ID, "_slide_link_url", true ) . '" title="' . the_title_attribute ( array( 'echo' => 0 ) ) . '" >' . get_the_title() . '</a></h2>';
}