diff options
| author | matz <matz@b2dd03c8-39d4-4d8f-98ff-823fe69b080e> | 2008-12-30 16:07:14 +0000 |
|---|---|---|
| committer | matz <matz@b2dd03c8-39d4-4d8f-98ff-823fe69b080e> | 2008-12-30 16:07:14 +0000 |
| commit | dbeae0d7c1267d45c4850923a3f28229117ec08f (patch) | |
| tree | 1e09ddf25a7bf3943e16bfcdaca5106024f4f42b | |
| parent | beda9ee71ea7b4fca94a836029eaa34c719659e7 (diff) | |
| download | ruby-dbeae0d7c1267d45c4850923a3f28229117ec08f.tar.gz ruby-dbeae0d7c1267d45c4850923a3f28229117ec08f.tar.xz ruby-dbeae0d7c1267d45c4850923a3f28229117ec08f.zip | |
* object.c (rb_to_float): prohibit conversion from nil to float.
[ruby-dev:37663]
git-svn-id: http://svn.ruby-lang.org/repos/ruby/trunk@21204 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
| -rw-r--r-- | ChangeLog | 5 | ||||
| -rw-r--r-- | object.c | 3 |
2 files changed, 8 insertions, 0 deletions
@@ -1,3 +1,8 @@ +Wed Dec 31 00:27:54 2008 Yukihiro Matsumoto <matz@ruby-lang.org> + + * object.c (rb_to_float): prohibit conversion from nil to float. + [ruby-dev:37663] + Tue Dec 30 21:17:00 2008 Tanaka Akira <akr@fsij.org> * ext/socket/mkconstants.rb: use sock_define_uconst for INADDR_* @@ -2273,6 +2273,9 @@ rb_to_float(VALUE val) VALUE v; if (TYPE(val) == T_FLOAT) return val; + if (NIL_P(val)) { + rb_raise(rb_eTypeError, "can't convert nil into Float"); + } v = convert_type(val, "Float", "to_f", Qtrue); if (TYPE(v) != T_FLOAT) { const char *cname = rb_obj_classname(val); |
