From cefd28a84fb25b80d8afeea15df03ac90ac1d615 Mon Sep 17 00:00:00 2001 From: akr Date: Thu, 21 Aug 2008 10:20:55 +0000 Subject: * file.c (rb_stat_inspect): don't raise if self is not initialized. git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@18753 b2dd03c8-39d4-4d8f-98ff-823fe69b080e --- file.c | 6 ++++++ 1 file changed, 6 insertions(+) (limited to 'file.c') diff --git a/file.c b/file.c index 970875f946..3c932cd2ec 100644 --- a/file.c +++ b/file.c @@ -671,6 +671,12 @@ rb_stat_inspect(VALUE self) {"ctime", rb_stat_ctime}, }; + struct stat* st; + Data_Get_Struct(self, struct stat, st); + if (!st) { + return rb_sprintf("#<%s: uninitialized>", rb_obj_classname(self)); + } + str = rb_str_buf_new2("#<"); rb_str_buf_cat2(str, rb_obj_classname(self)); rb_str_buf_cat2(str, " "); -- cgit v1.2.3