018272ee5b
This just skips the entire algorithm when there are cycles. In the future, cycles could be handled more gracefully in the algorithm, but for now that's not worth it and is not necessary to fix the bug.