From 8f7bae2cfcbbfa6f50167a1538cd267e5ad579be Mon Sep 17 00:00:00 2001 From: Pavel Emelyanov Date: Tue, 4 Feb 2014 11:52:55 +0400 Subject: [PATCH] pb: Don't crash when showing empty repeated field Signed-off-by: Pavel Emelyanov --- protobuf.c | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/protobuf.c b/protobuf.c index 6bf3da908..5e62b085f 100644 --- a/protobuf.c +++ b/protobuf.c @@ -184,7 +184,8 @@ static size_t pb_show_prepare_field_context(const ProtobufCFieldDescriptor *fd, break; case PROTOBUF_C_TYPE_MESSAGE: ctl->arg = (void *)fd->descriptor; - field->data = (void *)(*(long *)field->data); + if (field->data) + field->data = (void *)(*(long *)field->data); case PROTOBUF_C_TYPE_STRING: fsize = sizeof (void *); break;