I receive the following notice Undefined offset: 0 in.........
Category: <?php $category = get_the_category();
if($category[0]){
echo '<a href="'.get_category_link($category[0]->term_id ).'">'.$category[0]->cat_name.'</a>'; }
?>
| <?php comments_popup_link( 'Add a comment', '1 comment', '% Comments' ); ?>
</div>
The error is on this line
if($category[0]){
How to fix the notice.