safe-length

safe-length is a built-in function in `C source code'.

(safe-length LIST)

Return the length of a list, but avoid error or infinite loop.
This function never gets an error. If LIST is not really a list,
it returns 0. If LIST is circular, it returns a finite value
which is at least the number of distinct elements.