From 32831c11e0692e8744e768c6b022e4756d3dcab6 Mon Sep 17 00:00:00 2001 From: "Sunrin SHIMURA (keen)" <3han5chou7@gmail.com> Date: Wed, 4 Feb 2015 14:05:34 +0000 Subject: [PATCH] fix #257 --- extlib/benz/pair.c | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/extlib/benz/pair.c b/extlib/benz/pair.c index fc865921..1f1f3043 100644 --- a/extlib/benz/pair.c +++ b/extlib/benz/pair.c @@ -643,8 +643,12 @@ pic_pair_map(pic_state *pic) pic_value *args; pic_value arg, ret; + argc = 0; pic_get_args(pic, "l*", &proc, &argc, &args); + if (argc == 0) + pic_errorf(pic, "map: wrong number of arguments (1 for at least 2)"); + ret = pic_nil_value(); do { arg = pic_nil_value(); @@ -655,6 +659,7 @@ pic_pair_map(pic_state *pic) pic_push(pic, pic_car(pic, args[i]), arg); args[i] = pic_cdr(pic, args[i]); } + if (i != argc) { break; }