Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP
Browse files

check what iv_dict is not NULL because rb_class_ivar_dict() may retur…

…n NULL
  • Loading branch information...
commit 191a9948fa91d849cb4bf7a31933bfc197701fe6 1 parent 830da71
@Watson1978 Watson1978 authored
Showing with 2 additions and 2 deletions.
  1. +2 −2 variable.c
View
4 variable.c
@@ -1492,7 +1492,7 @@ rb_const_get_0(VALUE klass, ID id, int exclude, int recurse)
for (i = 0; i < count; i++) {
VALUE mod = RARRAY_AT(inc_mods, i);
iv_dict = rb_class_ivar_dict(mod);
- if (CFDictionaryGetValueIfPresent(iv_dict, (const void *)id,
+ if (iv_dict != NULL && CFDictionaryGetValueIfPresent(iv_dict, (const void *)id,
(const void **)&value)) {
if (value == Qundef) {
if (!RTEST(rb_autoload_load(mod, id))) {
@@ -1705,7 +1705,7 @@ rb_const_defined_0(VALUE klass, ID id, int exclude, int recurse)
int i, count = RARRAY_LEN(inc_mods);
for (i = 0; i < count; i++) {
iv_dict = rb_class_ivar_dict(RARRAY_AT(inc_mods, i));
- if (CFDictionaryGetValueIfPresent(iv_dict, (const void *)id, (const void **)&value))
+ if (iv_dict != NULL && CFDictionaryGetValueIfPresent(iv_dict, (const void *)id, (const void **)&value))
return Qtrue;
}
}
Please sign in to comment.
Something went wrong with that request. Please try again.