diff options
author | ko1 <ko1@b2dd03c8-39d4-4d8f-98ff-823fe69b080e> | 2018-11-27 03:02:41 +0000 |
---|---|---|
committer | ko1 <ko1@b2dd03c8-39d4-4d8f-98ff-823fe69b080e> | 2018-11-27 03:02:41 +0000 |
commit | 2b44228d6f4e504bbadc576efedbf26b9c12ecc8 (patch) | |
tree | 6c98c88ad28df2a45c469203f7a82c355ada1778 /iseq.c | |
parent | 467c29820a99225312c88fd5732a73af8484b3f3 (diff) |
fix for ISeq.of(method).
* iseq.c (iseqw_s_of): `rb_method_iseq(method)` can return NULL.
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@66017 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
Diffstat (limited to 'iseq.c')
-rw-r--r-- | iseq.c | 14 |
1 files changed, 5 insertions, 9 deletions
@@ -2322,24 +2322,20 @@ iseqw_s_of(VALUE klass, VALUE body) if (rb_obj_is_proc(body)) { iseq = vm_proc_iseq(body); - if (rb_obj_is_iseq((VALUE)iseq)) { - return iseqw_new(iseq); - } - else { - return Qnil; + if (!rb_obj_is_iseq((VALUE)iseq)) { + iseq = NULL; } } else if (rb_obj_is_method(body)) { - return iseqw_new(rb_method_iseq(body)); + iseq = rb_method_iseq(body); } else if (RB_TYPE_P(body, T_DATA) && RTYPEDDATA_P(body) && RTYPEDDATA_TYPE(body) == &iseqw_data_type) { return body; } - else { - return Qnil; - } + + return iseq ? iseqw_new(iseq) : Qnil; } /* |