summaryrefslogtreecommitdiff
path: root/ext/openssl/ossl.c
diff options
context:
space:
mode:
Diffstat (limited to 'ext/openssl/ossl.c')
-rw-r--r--ext/openssl/ossl.c5
1 files changed, 3 insertions, 2 deletions
diff --git a/ext/openssl/ossl.c b/ext/openssl/ossl.c
index 614d2fa6f7..7f9105c117 100644
--- a/ext/openssl/ossl.c
+++ b/ext/openssl/ossl.c
@@ -312,10 +312,11 @@ ossl_make_error(VALUE exc, const char *fmt, va_list args)
else
msg = ERR_reason_error_string(e);
if (NIL_P(str)) {
- str = rb_str_new_cstr(msg);
+ if (msg) str = rb_str_new_cstr(msg);
}
else {
- rb_str_cat2(rb_str_cat2(str, ": "), msg);
+ if (RSTRING_LEN(str)) rb_str_cat2(str, ": ");
+ rb_str_cat2(str, msg ? msg : "(null)");
}
}
if (dOSSL == Qtrue){ /* show all errors on the stack */