summaryrefslogtreecommitdiff
path: root/variable.c
diff options
context:
space:
mode:
Diffstat (limited to 'variable.c')
-rw-r--r--variable.c5
1 files changed, 3 insertions, 2 deletions
diff --git a/variable.c b/variable.c
index 5a0c451..dda92cd 100644
--- a/variable.c
+++ b/variable.c
@@ -318,10 +318,11 @@ rb_class_path_no_cache(VALUE klass)
VALUE
rb_class_path_cached(VALUE klass)
{
- st_table *ivtbl = RCLASS_IV_TBL(klass);
+ st_table *ivtbl;
st_data_t n;
- if (!ivtbl) return Qnil;
+ if (!RCLASS_EXT(klass)) return Qnil;
+ if (!(ivtbl = RCLASS_IV_TBL(klass))) return Qnil;
if (st_lookup(ivtbl, (st_data_t)classpath, &n)) return (VALUE)n;
if (st_lookup(ivtbl, (st_data_t)tmp_classpath, &n)) return (VALUE)n;
return Qnil;