Catchable fatal error on custom category post

You can wrap it in the same check used for $category:

<?php if (isset($term->term_id)) {
    echo '<a href="'.get_term_link($term).'">'.$term->name.'</a>';
} ?>

or check to make sure it is not an error object:

<?php if (!is_wp_error($term)) {
    echo '<a href="'.get_term_link($term).'">'.$term->name.'</a>';
} ?>