summaryrefslogtreecommitdiff
path: root/array.c
diff options
context:
space:
mode:
authormarcandre <marcandre@b2dd03c8-39d4-4d8f-98ff-823fe69b080e>2018-09-16 02:42:26 +0000
committermarcandre <marcandre@b2dd03c8-39d4-4d8f-98ff-823fe69b080e>2018-09-16 02:42:26 +0000
commit4452e857d4bb721cfeb74f9b69a94e5a194527db (patch)
tree35f5d25aa9b91921705b916b5d0b78712c0edf28 /array.c
parent4e62527c3306268f9f9afbcb9639048edc9069f0 (diff)
array.c: Optimize rb_ary_and. Patch by Stefan Schüßler. [Fix GH-1938]
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@64755 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
Diffstat (limited to 'array.c')
-rw-r--r--array.c2
1 files changed, 1 insertions, 1 deletions
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<RARRAY_LEN(ary1); i++) {