mirror of
https://github.com/RetroShare/RetroShare.git
synced 2024-12-29 09:26:18 -05:00
Fixed: Libresapi was throwing exception when requested to add new cert which was empty
This commit is contained in:
parent
8e62a8b1b2
commit
f0ad68789b
@ -601,19 +601,30 @@ void PeersHandler::handleWildcard(Request &req, Response &resp)
|
||||
}
|
||||
RsPeerId peer_id;
|
||||
RsPgpId pgp_id;
|
||||
std::string cleanCert;
|
||||
int error_code;
|
||||
std::string error_string;
|
||||
if(mRsPeers->loadCertificateFromString(cert_string, peer_id, pgp_id, error_string)
|
||||
&& mRsPeers->addFriend(peer_id, pgp_id, flags))
|
||||
{
|
||||
ok = true;
|
||||
resp.mDataStream << makeKeyValueReference("pgp_id", pgp_id);
|
||||
resp.mDataStream << makeKeyValueReference("peer_id", peer_id);
|
||||
}
|
||||
else
|
||||
{
|
||||
resp.mDebug << "Error: failed to add peer" << std::endl;
|
||||
resp.mDebug << error_string << std::endl;
|
||||
}
|
||||
|
||||
if (mRsPeers->cleanCertificate(cert_string, cleanCert, error_code))
|
||||
{
|
||||
if(mRsPeers->loadCertificateFromString(cert_string, peer_id, pgp_id, error_string)
|
||||
&& mRsPeers->addFriend(peer_id, pgp_id, flags))
|
||||
{
|
||||
ok = true;
|
||||
resp.mDataStream << makeKeyValueReference("pgp_id", pgp_id);
|
||||
resp.mDataStream << makeKeyValueReference("peer_id", peer_id);
|
||||
}
|
||||
else
|
||||
{
|
||||
resp.mDebug << "Error: failed to add peer" << std::endl;
|
||||
resp.mDebug << error_string << std::endl;
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
resp.mDebug << "Error: failed to add peer" << std::endl;
|
||||
resp.mDebug << error_code << std::endl;
|
||||
}
|
||||
}
|
||||
}
|
||||
if(ok)
|
||||
|
Loading…
Reference in New Issue
Block a user