Change MessageType != null in IsInitialized to FieldType == Message || Group (#5688)

pull/5733/head
Sydney Acksman 6 years ago committed by Jie Luo
parent 39c0947893
commit e7283254d6
  1. 4
      csharp/src/Google.Protobuf/MessageExtensions.cs

@ -163,12 +163,12 @@ namespace Google.Protobuf
var map = (IDictionary)f.Accessor.GetValue(message);
return map.Values.OfType<IMessage>().All(IsInitialized);
}
else if (f.IsRepeated && f.MessageType != null)
else if (f.IsRepeated && f.FieldType == FieldType.Message || f.FieldType == FieldType.Group)
{
var enumerable = (IEnumerable)f.Accessor.GetValue(message);
return enumerable.Cast<IMessage>().All(IsInitialized);
}
else if (f.MessageType != null)
else if (f.FieldType == FieldType.Message || f.FieldType == FieldType.Group)
{
if (f.Accessor.HasValue(message))
{

Loading…
Cancel
Save