check endpoints is not empty before use it.

Signed-off-by: VRan Liu <gliuwr@gmail.com>
Merge pull request #2985 from CzBiX/quick-fix

rgw: check endpoints is not empty before use it.

This fixes a regression due to commit 3c4b782bcb5460523982a04b1e5c7963e08a1687

Reported-by: Mykola Golub <to.my.trociny@gmail.com>