Check that requests[0] is not undefined before using it.