THRIFT-192. erl: Fix handling of booleans
git-svn-id: https://svn.apache.org/repos/asf/incubator/thrift/trunk@757870 13f79535-47bb-0310-9956-ffa450edef68
diff --git a/lib/erl/src/thrift_binary_protocol.erl b/lib/erl/src/thrift_binary_protocol.erl
index e53f5ef..c6dde33 100644
--- a/lib/erl/src/thrift_binary_protocol.erl
+++ b/lib/erl/src/thrift_binary_protocol.erl
@@ -231,9 +231,10 @@
%%
read(This, bool) ->
- Byte = read(This, byte),
- {ok, (Byte /= 0)};
-
+ case read(This, byte) of
+ {ok, Byte} -> {ok, Byte /= 0};
+ Else -> Else
+ end;
read(This, byte) ->
case read(This, 1) of
diff --git a/test/ThriftTest.thrift b/test/ThriftTest.thrift
index a042d7e..e7152c4 100644
--- a/test/ThriftTest.thrift
+++ b/test/ThriftTest.thrift
@@ -22,6 +22,11 @@
2: i32 type
}
+struct Bools {
+ 1: bool im_true,
+ 2: bool im_false,
+}
+
struct Xtruct
{
1: string string_thing,