caos.tree.transformer: Fix crash in entityref_to_record
caos.tree.transformer: Fix crash in entityref_to_record

Fix a crash in entityref_to_record() occuring when link target is not
an atom, and recursion has been prohibited to avoid infinite looping.

edgedb/edgedb,edgedb/edgedb,edgedb/edgedb