From 4452e857d4bb721cfeb74f9b69a94e5a194527db Mon Sep 17 00:00:00 2001 From: marcandre Date: Sun, 16 Sep 2018 02:42:26 +0000 Subject: =?UTF-8?q?array.c:=20Optimize=20rb=5Fary=5Fand.=20Patch=20by=20St?= =?UTF-8?q?efan=20Sch=C3=BC=C3=9Fler.=20[Fix=20GH-1938]?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@64755 b2dd03c8-39d4-4d8f-98ff-823fe69b080e --- array.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'array.c') diff --git a/array.c b/array.c index 813605226f..3c36bb66e6 100644 --- a/array.c +++ b/array.c @@ -4236,7 +4236,7 @@ rb_ary_and(VALUE ary1, VALUE ary2) ary2 = to_ary(ary2); ary3 = rb_ary_new(); - if (RARRAY_LEN(ary2) == 0) return ary3; + if (RARRAY_LEN(ary1) == 0 || RARRAY_LEN(ary2) == 0) return ary3; if (RARRAY_LEN(ary1) <= SMALL_ARRAY_LEN && RARRAY_LEN(ary2) <= SMALL_ARRAY_LEN) { for (i=0; i