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

This commit is contained in:
Sydney Acksman 2019-02-14 13:34:15 -06:00 committed by Jie Luo
parent 39c0947893
commit e7283254d6

View File

@ -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))
{