Patch from AsamK to avoid crash when no uids are present in the key. How can this happen anyway?

git-svn-id: http://svn.code.sf.net/p/retroshare/code/trunk@5535 b45a01b8-16f6-495d-af2f-9b41ad6348cc
This commit is contained in:
csoler 2012-09-10 20:24:02 +00:00
parent 9049440253
commit 15caadff6b

View File

@ -50,7 +50,10 @@ ops_parse_cb_return_t cb_get_passphrase(const ops_parser_content_t *content_,ops
case OPS_PARSER_CMD_GET_SK_PASSPHRASE: case OPS_PARSER_CMD_GET_SK_PASSPHRASE:
{ {
std::string passwd; std::string passwd;
std::string uid_hint = std::string((const char *)cbinfo->cryptinfo.keydata->uids[0].user_id) ; std::string uid_hint ;
if(cbinfo->cryptinfo.keydata->nuids > 0)
uid_hint = std::string((const char *)cbinfo->cryptinfo.keydata->uids[0].user_id) ;
uid_hint += "(" + PGPIdType(cbinfo->cryptinfo.keydata->key_id).toStdString()+")" ; uid_hint += "(" + PGPIdType(cbinfo->cryptinfo.keydata->key_id).toStdString()+")" ;
passwd = PGPHandler::passphraseCallback()(NULL,uid_hint.c_str(),NULL,prev_was_bad) ; passwd = PGPHandler::passphraseCallback()(NULL,uid_hint.c_str(),NULL,prev_was_bad) ;