summaryrefslogtreecommitdiff
path: root/object.c
diff options
context:
space:
mode:
authornormal <normal@b2dd03c8-39d4-4d8f-98ff-823fe69b080e>2014-09-25 20:29:15 +0000
committernormal <normal@b2dd03c8-39d4-4d8f-98ff-823fe69b080e>2014-09-25 20:29:15 +0000
commit0ef94bd2afa035648032e382201f1c9af29c5c3a (patch)
tree2ece6c9bf074ba2bcaacc64220a1a30c0dc7e4ec /object.c
parente0f02160bcb09a1cef051b59da52432082adfc6f (diff)
object.c (rb_class_real): do not dereference 0 VALUE
* test/ruby/test_module.rb (test_inspect_segfault): Test case and bug report by Thomas Stratmann. [ruby-core:65214] [Bug #10282] git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@47715 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
Diffstat (limited to 'object.c')
-rw-r--r--object.c5
1 files changed, 2 insertions, 3 deletions
diff --git a/object.c b/object.c
index 5b0f7df..3126ed0 100644
--- a/object.c
+++ b/object.c
@@ -206,9 +206,8 @@ rb_obj_not_equal(VALUE obj1, VALUE obj2)
VALUE
rb_class_real(VALUE cl)
{
- if (cl == 0)
- return 0;
- while ((RBASIC(cl)->flags & FL_SINGLETON) || BUILTIN_TYPE(cl) == T_ICLASS) {
+ while (cl &&
+ ((RBASIC(cl)->flags & FL_SINGLETON) || BUILTIN_TYPE(cl) == T_ICLASS)) {
cl = RCLASS_SUPER(cl);
}
return cl;