aboutsummaryrefslogtreecommitdiffstats
path: root/io.c
diff options
context:
space:
mode:
Diffstat (limited to 'io.c')
-rw-r--r--io.c5
1 files changed, 4 insertions, 1 deletions
diff --git a/io.c b/io.c
index 1b98b6ae0d..c17fc9e93f 100644
--- a/io.c
+++ b/io.c
@@ -6103,8 +6103,11 @@ argf_set_encoding(int argc, VALUE *argv, VALUE io)
{
rb_io_t *fptr;
+ if (next_argv()) {
+ rb_raise(rb_eArgError, "no stream to set encoding");
+ }
rb_io_set_encoding(argc, argv, current_file);
- GetOpenFile(io, fptr);
+ GetOpenFile(current_file, fptr);
argf_enc = fptr->enc;
argf_enc2 = fptr->enc2;
return io;