Permalink
Browse files

class variable table intialization bug; close #206

  • Loading branch information...
1 parent 42b4060 commit 84c5d35b9e95e1baaa1a28fcf23981068b075621 @matz matz committed May 29, 2012
Showing with 5 additions and 1 deletion.
  1. +5 −1 src/variable.c
View
@@ -186,12 +186,16 @@ mrb_vm_cv_set(mrb_state *mrb, mrb_sym sym, mrb_value v)
if (k != kh_end(h)) {
k = kh_put(iv, h, sym);
kh_value(h, k) = v;
+ return;
}
}
c = c->super;
}
c = mrb->ci->target_class;
- h = c->iv = kh_init(iv, mrb);
+ h = c->iv;
+ if (!h) {
+ c->iv = h = kh_init(iv, mrb);
+ }
k = kh_put(iv, h, sym);
kh_value(h, k) = v;
}

0 comments on commit 84c5d35

Please sign in to comment.