From 15caadff6b12e108451b05e544af7dc43d0a569a Mon Sep 17 00:00:00 2001 From: csoler Date: Mon, 10 Sep 2012 20:24:02 +0000 Subject: [PATCH] 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 --- libretroshare/src/pgp/pgphandler.cc | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/libretroshare/src/pgp/pgphandler.cc b/libretroshare/src/pgp/pgphandler.cc index 04de9aaab..19e71d458 100644 --- a/libretroshare/src/pgp/pgphandler.cc +++ b/libretroshare/src/pgp/pgphandler.cc @@ -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: { 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()+")" ; passwd = PGPHandler::passphraseCallback()(NULL,uid_hint.c_str(),NULL,prev_was_bad) ;