aboutsummaryrefslogtreecommitdiffhomepage
path: root/src/ruby
diff options
context:
space:
mode:
authorGravatar David Garcia Quintas <dgq@google.com>2016-06-30 17:17:23 -0700
committerGravatar David Garcia Quintas <dgq@google.com>2016-06-30 17:30:08 -0700
commit6721d4f0f18c71f5e4ab1cef904944185ed86b89 (patch)
tree6b3b3ff93eba1bb9290ca44e4cdfc67dd60286ae /src/ruby
parenta5596db1a53723789d7c90c23d9cbfbb8207f949 (diff)
Return success status of grpc_byte_buffer_reader
Diffstat (limited to 'src/ruby')
-rw-r--r--src/ruby/ext/grpc/rb_byte_buffer.c5
1 files changed, 4 insertions, 1 deletions
diff --git a/src/ruby/ext/grpc/rb_byte_buffer.c b/src/ruby/ext/grpc/rb_byte_buffer.c
index 1172691116..61b7c30315 100644
--- a/src/ruby/ext/grpc/rb_byte_buffer.c
+++ b/src/ruby/ext/grpc/rb_byte_buffer.c
@@ -56,7 +56,10 @@ VALUE grpc_rb_byte_buffer_to_s(grpc_byte_buffer *buffer) {
return Qnil;
}
rb_string = rb_str_buf_new(grpc_byte_buffer_length(buffer));
- grpc_byte_buffer_reader_init(&reader, buffer);
+ if (!grpc_byte_buffer_reader_init(&reader, buffer)) {
+ rb_raise(rb_eRuntimeError, "Error initializing byte buffer reader.");
+ return Qnil;
+ }
while (grpc_byte_buffer_reader_next(&reader, &next) != 0) {
rb_str_cat(rb_string, (const char *) GPR_SLICE_START_PTR(next),
GPR_SLICE_LENGTH(next));