diff --git a/arangod/Cluster/v8-cluster.cpp b/arangod/Cluster/v8-cluster.cpp index 80e2330dc9..7277aa993b 100644 --- a/arangod/Cluster/v8-cluster.cpp +++ b/arangod/Cluster/v8-cluster.cpp @@ -985,11 +985,20 @@ static void JS_GetDBServers(v8::FunctionCallbackInfo const& args) { auto serverAliases = ClusterInfo::instance()->getServerAliases(); v8::Handle l = v8::Array::New(isolate); + for (size_t i = 0; i < DBServers.size(); ++i) { v8::Handle result = v8::Object::New(isolate); - result->Set(TRI_V8_ASCII_STRING("serverId"), TRI_V8_STD_STRING(DBServers[i])); - result->Set(TRI_V8_ASCII_STRING("serverName"), - TRI_V8_STD_STRING(serverAliases.at(DBServers[i]))); + auto id = DBServers[i]; + + result->Set(TRI_V8_ASCII_STRING("serverId"), TRI_V8_STD_STRING(id)); + + auto itr = serverAliases.find(id); + + if (itr != serverAliases.end()) { + result->Set(TRI_V8_ASCII_STRING("serverName"), + TRI_V8_STD_STRING(itr->second)); + } + l->Set((uint32_t)i, result); }