From e49673aaa9d5771eeb56504c14b8ffdea1d9bab9 Mon Sep 17 00:00:00 2001 From: Andrew Engelbrecht Date: Sun, 19 Jul 2015 19:44:08 -0400 Subject: [PATCH] don't crash when given an invalid public key block --- edward | 8 +++++--- 1 file changed, 5 insertions(+), 3 deletions(-) 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 -- 2.25.1