about summary refs log tree commit diff stats
diff options
context:
space:
mode:
-rw-r--r--src/pgp/gpg.c8
1 files changed, 6 insertions, 2 deletions
diff --git a/src/pgp/gpg.c b/src/pgp/gpg.c
index 13a4608f..3d6bdc09 100644
--- a/src/pgp/gpg.c
+++ b/src/pgp/gpg.c
@@ -581,7 +581,9 @@ p_gpg_sign(const char * const str, const char * const fp)
         gpgme_free(signed_str);
     }
 
-    passphrase = strdup(passphrase_attempt);
+    if (passphrase_attempt) {
+        passphrase = strdup(passphrase_attempt);
+    }
 
     return result;
 }
@@ -710,7 +712,9 @@ p_gpg_decrypt(const char * const cipher)
     }
     gpgme_free(plain_str);
 
-    passphrase = strdup(passphrase_attempt);
+    if (passphrase_attempt) {
+        passphrase = strdup(passphrase_attempt);
+    }
 
     return result;
 }