rgw: check endpoints is not empty before use it.

Signed-off-by: VRan Liu <gliuwr@gmail.com>