Check for null parent in recureElement

The check is done elsewhere in this method, it should be done here as
well