From 4215bca0e35014bdd72713ab201e8f4780b998d2 Mon Sep 17 00:00:00 2001 From: Amir Libeman Date: Tue, 27 Apr 2021 14:53:06 -0400 Subject: [PATCH] Update UnionSerializer.cs --- src/Microsoft.Hadoop.Avro/Serializers/UnionSerializer.cs | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/Microsoft.Hadoop.Avro/Serializers/UnionSerializer.cs b/src/Microsoft.Hadoop.Avro/Serializers/UnionSerializer.cs index db3f920..a656288 100644 --- a/src/Microsoft.Hadoop.Avro/Serializers/UnionSerializer.cs +++ b/src/Microsoft.Hadoop.Avro/Serializers/UnionSerializer.cs @@ -62,8 +62,8 @@ protected override Expression BuildDeserializerSafe(Expression decoder) ParameterExpression resultParameter = Expression.Variable(this.Schema.RuntimeType, "result"); ParameterExpression unionTypeParameter = Expression.Variable(typeof(int), "unionType"); BinaryExpression assignUnionType = Expression.Assign(unionTypeParameter, Expression.Call(decoder, this.Decode(), new Expression[] { })); - - Expression elseBranch = Expression.Empty(); + + Expression elseBranch = Expression.Assign(resultParameter, Expression.Convert(Expression.Constant(null), this.Schema.RuntimeType)); ConditionalExpression conditions = null; for (int i = this.itemSchemas.Count - 1; i >= 0; i--) {