Fix a bug in the cycle detector when goodrepos is empty