Error handler was not called when currentState was undefined/null