summaryrefslogtreecommitdiff
path: root/hash.c
diff options
context:
space:
mode:
Diffstat (limited to 'hash.c')
-rw-r--r--hash.c3
1 files changed, 2 insertions, 1 deletions
diff --git a/hash.c b/hash.c
index 39a9a522d7..c8d2857563 100644
--- a/hash.c
+++ b/hash.c
@@ -668,7 +668,8 @@ static VALUE
rb_hash_inspect(hash)
VALUE hash;
{
- if (RHASH(hash)->tbl->num_entries == 0) return rb_str_new2("{}");
+ if (RHASH(hash)->tbl == 0 || RHASH(hash)->tbl->num_entries == 0)
+ return rb_str_new2("{}");
if (rb_inspecting_p(hash)) return rb_str_new2("{...}");
return rb_protect_inspect(inspect_hash, hash, 0);
}