From: Andrew Engelbrecht Date: Sun, 19 Jul 2015 23:44:08 +0000 (-0400) Subject: don't crash when given an invalid public key block X-Git-Url: https://vcs.fsf.org/?a=commitdiff_plain;h=e49673aaa9d5771eeb56504c14b8ffdea1d9bab9;p=edward.git don't crash when given an invalid public key block --- diff --git a/edward b/edward index cd58536..ca6ef08 100755 --- a/edward +++ b/edward @@ -163,11 +163,13 @@ def add_gpg_keys (text, gpgme_ctx): fp = io.BytesIO(key_block.encode('ascii')) result = gpgme_ctx.import_(fp) + imports = result.imports - fingerprint = result.imports[0][0] - debug("added gpg key: " + fingerprint) + if imports != []: + fingerprint = imports[0][0] + keys += [gpgme_ctx.get_key(fingerprint)] - keys += [gpgme_ctx.get_key(fingerprint)] + debug("added gpg key: " + fingerprint) return keys