Skip to content

Commit

Permalink
Object#display will raise an exception if passed nil
Browse files Browse the repository at this point in the history
  • Loading branch information
Watson1978 committed Jul 31, 2012
1 parent 51b862a commit 830da71
Showing 1 changed file with 5 additions and 2 deletions.
7 changes: 5 additions & 2 deletions io.c
Expand Up @@ -3427,10 +3427,13 @@ static VALUE
rb_obj_display(VALUE self, SEL sel, int argc, VALUE *argv) rb_obj_display(VALUE self, SEL sel, int argc, VALUE *argv)
{ {
VALUE port; VALUE port;
rb_scan_args(argc, argv, "01", &port);
if (NIL_P(port)) { if (argc == 0) {
port = rb_stdout; port = rb_stdout;
} }
else {
rb_scan_args(argc, argv, "01", &port);
}
rb_io_write(port, self); rb_io_write(port, self);


return Qnil; return Qnil;
Expand Down

0 comments on commit 830da71

Please sign in to comment.