Avoid panicking when text formatting a malformed oneof.
diff --git a/proto/text_test.go b/proto/text_test.go
index 7ff180d..3eabaca 100644
--- a/proto/text_test.go
+++ b/proto/text_test.go
@@ -221,6 +221,8 @@
{&pb.Communique{Union: &pb.Communique_Msg{
&pb.Strings{StringField: proto.String("why hello!")},
}}, `msg:<string_field:"why hello!" >`},
+ // bad oneof (should not panic)
+ {&pb.Communique{Union: &pb.Communique_Msg{nil}}, `msg:/* nil */`},
}
for _, test := range tests {
got := strings.TrimSpace(test.m.String())