summaryrefslogtreecommitdiff
path: root/ext/iconv/iconv.c
diff options
context:
space:
mode:
Diffstat (limited to 'ext/iconv/iconv.c')
-rw-r--r--ext/iconv/iconv.c2
1 files changed, 1 insertions, 1 deletions
diff --git a/ext/iconv/iconv.c b/ext/iconv/iconv.c
index 2366a350cc..a7b1b4118e 100644
--- a/ext/iconv/iconv.c
+++ b/ext/iconv/iconv.c
@@ -188,7 +188,7 @@ iconv_failure_initialize
struct iconv_env_t *env;
#endif /* HAVE_PROTOTYPES */
{
- if (NIL_P(rb_ivar_get(error, rb_mesg)))
+ if (!rb_ivar_defined(error, rb_mesg) || NIL_P(rb_ivar_get(error, rb_mesg)))
rb_ivar_set(error, rb_mesg, rb_inspect(failed));
if (env) {
success = rb_funcall3(env->ret, rb_inserter, 1, &success);