diff --git a/vm_insnhelper.c b/vm_insnhelper.c index e17f9ba382..d9c2087243 100644 --- a/vm_insnhelper.c +++ b/vm_insnhelper.c @@ -40,6 +40,13 @@ static int callable_class_p(VALUE klass) { #if VM_CHECK_MODE >= 2 + if (!klass) return FALSE; + switch (RB_BUILTIN_TYPE(klass)) { + case T_ICLASS: + if (!RB_TYPE_P(RCLASS_SUPER(klass), T_MODULE)) break; + case T_MODULE: + return TRUE; + } while (klass) { if (klass == rb_cBasicObject) { return TRUE;