Testing for NaN at each quadrature point, I mean - "check the whole residual for NaN and back off if you find one" is in a solver or two.