From a8c436d9a1d333e9391c78d4ffd32568a56534a6 Mon Sep 17 00:00:00 2001 From: Jeremy Evans Date: Sun, 29 Sep 2019 22:49:43 -0700 Subject: [PATCH] Issue keyword flag warning even with no arguments If the keyword flag is set, there should be at least one argument, if there isn't, that is a sign the keyword flag was passed when it should not have been. --- vm_eval.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/vm_eval.c b/vm_eval.c index c741773657..1c205f0a30 100644 --- a/vm_eval.c +++ b/vm_eval.c @@ -256,7 +256,7 @@ rb_adjust_argv_kw_splat(int *argc, const VALUE **argv, int *kw_splat) } } - if (*kw_splat && *argc > 0 && !RB_TYPE_P((*argv)[(*argc)-1], T_HASH)) { + if (*kw_splat && (*argc == 0 || !RB_TYPE_P((*argv)[(*argc)-1], T_HASH))) { rb_warn("Keyword flag passed calling internal method, but last entry is not a hash, unsetting keyword flag"); *kw_splat = 0; }