Fix: Reference::compare() shall not assert

if either of the references given is invalid.