Commit 6a9e5bbd authored by Pavel Emelyanov's avatar Pavel Emelyanov

show: Fix optional submessage showing

Wrong pointer was checked against NULL and default value. This resulted
in lost tc part of the core message in show output.
Signed-off-by: 's avatarPavel Emelyanov <xemul@parallels.com>
parent 148497e4
......@@ -285,7 +285,7 @@ static void pb_show_field(const ProtobufCFieldDescriptor *fd, void *where,
}
static int pb_optional_field_present(const ProtobufCFieldDescriptor *field,
void *msg)
const void *msg)
{
if ((field->type == PROTOBUF_C_TYPE_MESSAGE) ||
(field->type == PROTOBUF_C_TYPE_STRING)) {
......@@ -318,7 +318,7 @@ static void pb_show_msg(const void *msg, pb_pr_ctl_t *ctl)
data = (unsigned long *)(msg + fd.offset);
if (fd.label == PROTOBUF_C_LABEL_OPTIONAL) {
if (!pb_optional_field_present(&fd, data))
if (!pb_optional_field_present(&fd, msg))
continue;
}
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment