diff options
| author | Yukihiro Matsumoto <[email protected]> | 2012-05-29 23:00:45 +0900 |
|---|---|---|
| committer | Yukihiro Matsumoto <[email protected]> | 2012-05-29 23:00:45 +0900 |
| commit | 84c5d35b9e95e1baaa1a28fcf23981068b075621 (patch) | |
| tree | 43d1e440da47cd19a379657f9cbfa3f3fea4d5b9 /src/variable.c | |
| parent | 42b4060c9d75601b81b537323b969c69212a520e (diff) | |
| download | mruby-84c5d35b9e95e1baaa1a28fcf23981068b075621.tar.gz mruby-84c5d35b9e95e1baaa1a28fcf23981068b075621.zip | |
class variable table intialization bug; close #206
Diffstat (limited to 'src/variable.c')
| -rw-r--r-- | src/variable.c | 6 |
1 files changed, 5 insertions, 1 deletions
diff --git a/src/variable.c b/src/variable.c index 1f1a400cd..82ab7bef3 100644 --- a/src/variable.c +++ b/src/variable.c @@ -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; } |
