summaryrefslogtreecommitdiff
path: root/lib/rb/lib
diff options
context:
space:
mode:
authorBryan Duxbury <bryanduxbury@apache.org>2011-09-20 18:45:56 +0000
committerBryan Duxbury <bryanduxbury@apache.org>2011-09-20 18:45:56 +0000
commite80a194c473e94f90b30919da29cbe9b4542e244 (patch)
tree16f539b1ba856b1b9f3a9b92687c1fadf4d737b4 /lib/rb/lib
parent7e3b866a3558411e99986144061339c21f6125c0 (diff)
downloadthrift-e80a194c473e94f90b30919da29cbe9b4542e244.tar.gz
THRIFT-1331. rb: Ruby library deserializes an empty map to nil
This patch properly detects when the metadata is omitted in Compact Protocol messages. Patch: Armaan Sarkar git-svn-id: https://svn.apache.org/repos/asf/thrift/trunk@1173300 13f79535-47bb-0310-9956-ffa450edef68
Diffstat (limited to 'lib/rb/lib')
-rw-r--r--lib/rb/lib/thrift/struct_union.rb2
1 files changed, 1 insertions, 1 deletions
diff --git a/lib/rb/lib/thrift/struct_union.rb b/lib/rb/lib/thrift/struct_union.rb
index 0ff175f6a..4e0afcfe6 100644
--- a/lib/rb/lib/thrift/struct_union.rb
+++ b/lib/rb/lib/thrift/struct_union.rb
@@ -56,7 +56,7 @@ module Thrift
when Types::MAP
key_type, val_type, size = iprot.read_map_begin
# Skip the map contents if the declared key or value types don't match the expected ones.
- if (key_type != field[:key][:type] || val_type != field[:value][:type])
+ if (size != 0 && (key_type != field[:key][:type] || val_type != field[:value][:type]))
size.times do
iprot.skip(key_type)
iprot.skip(val_type)