From d54cafb7c8dffab9cb54d23ed3997207760773dc Mon Sep 17 00:00:00 2001 From: Luc Thevenard Date: Wed, 6 Apr 2022 15:49:08 -0400 Subject: [PATCH] Avoid negative indexes for JRuby --- ruby/lib/google/protobuf/repeated_field.rb | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/ruby/lib/google/protobuf/repeated_field.rb b/ruby/lib/google/protobuf/repeated_field.rb index 5c1e906535..13b9300b2e 100644 --- a/ruby/lib/google/protobuf/repeated_field.rb +++ b/ruby/lib/google/protobuf/repeated_field.rb @@ -96,7 +96,7 @@ module Google raise ArgumentError, "negative array size" else start = [self.size-n, 0].max - return self[start..-1] + return self[start...self.size] end end