From 49d31f1636e693dd0e1405ab16e78f539d25ce97 Mon Sep 17 00:00:00 2001
From: Pierre Roullon <pierre.roullon@gmail.com>
Date: Wed, 21 Dec 2016 14:54:48 +0000
Subject: [PATCH] fix (helper): fix isFieldMessage

---
 helpers.go | 6 ++----
 1 file changed, 2 insertions(+), 4 deletions(-)

diff --git a/helpers.go b/helpers.go
index 877bd05..7909c19 100644
--- a/helpers.go
+++ b/helpers.go
@@ -75,10 +75,8 @@ func getMessageType(f *descriptor.FileDescriptorProto, name string) *descriptor.
 }
 
 func isFieldMessage(f *descriptor.FieldDescriptorProto) bool {
-	if f.Type != nil && *f.Type == descriptor.FieldDescriptorProto_TYPE_MESSAGE {
-		return true
-	}
-	if f.TypeName != nil && (*f.TypeName)[0] == '.' {
+	if f.Type != nil && *f.Type == descriptor.FieldDescriptorProto_TYPE_MESSAGE &&
+		f.Label != nil && *f.Label != descriptor.FieldDescriptorProto_LABEL_REPEATED {
 		return true
 	}