Verify that parents isn't empty before popping

If the first iteration of the loop isn't a match then parents will be an
empty list.