I include this logic in my template all the time
if (have_posts()):
//show content
else:
//show content not found
endif;
But recently i began to doubt its necessarity, wordpress will turn to 404.php when no post found, it seems no need to add this logic in normal templates, "else" will never be triggered, is it?