summaryrefslogtreecommitdiff
path: root/re.c
diff options
context:
space:
mode:
Diffstat (limited to 're.c')
-rw-r--r--re.c2
1 files changed, 1 insertions, 1 deletions
diff --git a/re.c b/re.c
index 49424eb632..34eeaa543c 100644
--- a/re.c
+++ b/re.c
@@ -3141,7 +3141,7 @@ rb_reg_s_last_match(int argc, VALUE *argv)
{
VALUE nth;
- if (rb_scan_args(argc, argv, "01", &nth) == 1) {
+ if (argc > 0 && rb_scan_args(argc, argv, "01", &nth) == 1) {
VALUE match = rb_backref_get();
int n;
if (NIL_P(match)) return Qnil;