[libfko] add ctx initialized check to fko_gpg_errstr()
authorMichael Rash <mbr@cipherdyne.org>
Wed, 10 Jul 2013 01:18:06 +0000 (21:18 -0400)
committerMichael Rash <mbr@cipherdyne.org>
Wed, 10 Jul 2013 01:18:06 +0000 (21:18 -0400)
lib/fko_error.c

index bd50d00..546e674 100644 (file)
@@ -210,6 +210,12 @@ const char*
 fko_gpg_errstr(fko_ctx_t ctx)
 {
 #if HAVE_LIBGPGME
+
+    /* Must be initialized
+     */
+    if(!CTX_INITIALIZED(ctx))
+        return("");
+
     if(ctx->gpg_err)
         return(gpgme_strerror(ctx->gpg_err));
 #endif /* HAVE_LIBGPGME */