Another small check for custom statuses (get_term() returns either WP_Error or null (so check for null too) ).