The reverse iteration added in e091291b5b didn't handle the case where there are no nodes properly. Thanks to Iliya Katueshenock for investigating this.
e091291b5b