Fix handling of ruby write parameters due to nil vs false
authorMark Slee <mcslee@apache.org>
Tue, 30 Oct 2007 16:55:47 +0000 (16:55 +0000)
committerMark Slee <mcslee@apache.org>
Tue, 30 Oct 2007 16:55:47 +0000 (16:55 +0000)
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

lib/rb/lib/thrift/thrift.rb

index d8e77a1..4a25959 100644 (file)
@@ -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])