Added: Checking if the vector is empty;

Changed: Grouped values into one member
This commit is contained in:
Konrad 2017-04-22 11:06:56 +02:00
parent 8c0b7ce776
commit f571b05693

View File

@ -388,6 +388,12 @@ void IdentityHandler::handleGetIdentityDetails(Request& req, Response& resp)
return; return;
} }
if(datavector.empty())
{
resp.setFail();
return;
}
data = datavector[0]; data = datavector[0];
resp.mDataStream << makeKeyValue("gxs_name", data.mMeta.mGroupName); resp.mDataStream << makeKeyValue("gxs_name", data.mMeta.mGroupName);
@ -468,9 +474,10 @@ void IdentityHandler::handleGetIdentityDetails(Request& req, Response& resp)
for(std::map<RsIdentityUsage,time_t>::const_iterator it(details.mUseCases.begin()); it != details.mUseCases.end(); ++it) for(std::map<RsIdentityUsage,time_t>::const_iterator it(details.mUseCases.begin()); it != details.mUseCases.end(); ++it)
{ {
usagesStream.getStreamToMember() << makeKeyValue("usage_time", difftime(now, data.mLastUsageTS)); usagesStream.getStreamToMember()
usagesStream.getStreamToMember() << makeKeyValue("usage_service", (int)(it->first.mServiceId)); << makeKeyValue("usage_time", difftime(now, data.mLastUsageTS))
usagesStream.getStreamToMember() << makeKeyValue("usage_case", (int)(it->first.mUsageCode)); << makeKeyValue("usage_service", (int)(it->first.mServiceId))
<< makeKeyValue("usage_case", (int)(it->first.mUsageCode));
} }
resp.setOk(); resp.setOk();