mirror of
https://github.com/ruby/ruby.git
synced 2022-11-09 12:17:21 -05:00
Fix crash when clearing method cache for builtin method
Builtin methods do not always have their mandatory_only_cme created (it is only created when called with only mandatory parameters), so it could be null. If we try to clear the cme, it will crash because it is null. Co-authored-by: Aaron Patterson <tenderlove@ruby-lang.org>
This commit is contained in:
parent
b95d7d2099
commit
c400165afa
Notes:
git
2021-11-17 23:03:27 +09:00
1 changed files with 1 additions and 1 deletions
|
@ -209,7 +209,7 @@ clear_method_cache_by_id_in_class(VALUE klass, ID mid)
|
|||
vm_cme_invalidate((rb_callable_method_entry_t *)cme);
|
||||
RB_DEBUG_COUNTER_INC(cc_invalidate_tree_cme);
|
||||
|
||||
if (cme->def->iseq_overload) {
|
||||
if (cme->def->iseq_overload && cme->def->body.iseq.mandatory_only_cme) {
|
||||
vm_cme_invalidate((rb_callable_method_entry_t *)cme->def->body.iseq.mandatory_only_cme);
|
||||
}
|
||||
}
|
||||
|
|
Loading…
Reference in a new issue