Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
13 changes: 6 additions & 7 deletions ext/date/date_core.c
Original file line number Diff line number Diff line change
Expand Up @@ -4468,7 +4468,6 @@ static VALUE
check_limit(VALUE str, VALUE opt)
{
size_t slen, limit;
if (NIL_P(str)) return str;
StringValue(str);
slen = RSTRING_LEN(str);
limit = get_limit(opt);
Expand Down Expand Up @@ -4620,7 +4619,7 @@ date_s__iso8601(int argc, VALUE *argv, VALUE klass)
VALUE str, opt;

rb_scan_args(argc, argv, "1:", &str, &opt);
str = check_limit(str, opt);
if (!NIL_P(str)) str = check_limit(str, opt);

return date__iso8601(str);
}
Expand Down Expand Up @@ -4690,7 +4689,7 @@ date_s__rfc3339(int argc, VALUE *argv, VALUE klass)
VALUE str, opt;

rb_scan_args(argc, argv, "1:", &str, &opt);
str = check_limit(str, opt);
if (!NIL_P(str)) str = check_limit(str, opt);

return date__rfc3339(str);
}
Expand Down Expand Up @@ -4759,7 +4758,7 @@ date_s__xmlschema(int argc, VALUE *argv, VALUE klass)
VALUE str, opt;

rb_scan_args(argc, argv, "1:", &str, &opt);
str = check_limit(str, opt);
if (!NIL_P(str)) str = check_limit(str, opt);

return date__xmlschema(str);
}
Expand Down Expand Up @@ -4828,7 +4827,7 @@ date_s__rfc2822(int argc, VALUE *argv, VALUE klass)
VALUE str, opt;

rb_scan_args(argc, argv, "1:", &str, &opt);
str = check_limit(str, opt);
if (!NIL_P(str)) str = check_limit(str, opt);

return date__rfc2822(str);
}
Expand Down Expand Up @@ -4896,7 +4895,7 @@ date_s__httpdate(int argc, VALUE *argv, VALUE klass)
VALUE str, opt;

rb_scan_args(argc, argv, "1:", &str, &opt);
str = check_limit(str, opt);
if (!NIL_P(str)) str = check_limit(str, opt);

return date__httpdate(str);
}
Expand Down Expand Up @@ -4965,7 +4964,7 @@ date_s__jisx0301(int argc, VALUE *argv, VALUE klass)
VALUE str, opt;

rb_scan_args(argc, argv, "1:", &str, &opt);
str = check_limit(str, opt);
if (!NIL_P(str)) str = check_limit(str, opt);

return date__jisx0301(str);
}
Expand Down
2 changes: 2 additions & 0 deletions test/date/test_date_parse.rb
Original file line number Diff line number Diff line change
Expand Up @@ -544,6 +544,8 @@ def test__parse__2

h = Date._parse('')
assert_equal({}, h)

assert_raise(TypeError) {Date._parse(nil)}
end

def test_parse
Expand Down