From: Mark Slee Date: Tue, 30 Oct 2007 16:55:47 +0000 (+0000) Subject: Fix handling of ruby write parameters due to nil vs false X-Git-Tag: 0.2.0~1162 X-Git-Url: https://source.supwisdom.com/gerrit/gitweb?a=commitdiff_plain;h=3e098b1757724eb2e78a4abc1306a32abaf610b2;p=common%2Fthrift.git Fix handling of ruby write parameters due to nil vs false Summary: Need to check for != nil, not just boolean expression Reviewed By: mcslee Test Plan: Send a boolean "false" value Other Notes: Patch submitted by Patrick Collison git-svn-id: https://svn.apache.org/repos/asf/incubator/thrift/trunk@665310 13f79535-47bb-0310-9956-ffa450edef68 --- diff --git a/lib/rb/lib/thrift/thrift.rb b/lib/rb/lib/thrift/thrift.rb index d8e77a15..4a25959d 100644 --- a/lib/rb/lib/thrift/thrift.rb +++ b/lib/rb/lib/thrift/thrift.rb @@ -206,7 +206,7 @@ module ThriftStruct def write(oprot) oprot.writeStructBegin(self.class.name) each_field do |fid, type, name| - if (value = instance_variable_get("@#{name}")) + if ((value = instance_variable_get("@#{name}")) != nil) if is_container? type oprot.writeFieldBegin(name, type, fid) write_container(oprot, value, fields[fid])