Do expert "telegrams lost" only of field is > 0;

Don't call expert...() under 'if (tree)'

svn path=/trunk/; revision=43683
This commit is contained in:
Bill Meier 2012-07-12 20:08:34 +00:00
parent d5b965176a
commit 5150511879
1 changed files with 129 additions and 129 deletions

View File

@ -119,7 +119,7 @@ dissect_esio(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree)
{
/* Set up structures needed to add the protocol subtree and manage it */
proto_item *ti, *et, *hi;
proto_item *ti, *et;
proto_tree *esio_tree, *esio_header_tree, *esio_transfer_header_tree,
*esio_data_tansfer_tree, *esio_data_tree;
@ -171,7 +171,6 @@ dissect_esio(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree)
}
/* create display subtree for the protocol */
if (tree) {
offset = 0;
ti = proto_tree_add_item(tree, proto_esio, tvb, offset, -1, ENC_NA);
esio_tree = proto_item_add_subtree(ti, ett_esio);
@ -195,6 +194,7 @@ dissect_esio(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree)
offset += 2;
switch (esio_tlg_type) {
case ESIO_TRANSFER:
if (tree) {
/*Add subtree for Ether-S-I/O header*/
et = proto_tree_add_text(esio_tree, tvb, offset, 12, "Transfer header");
esio_transfer_header_tree = proto_item_add_subtree(et, ett_esio_transfer_header);
@ -239,39 +239,39 @@ dissect_esio(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree)
offset += 1;
}
}
} /* if (tree) */
break;
case ESIO_STATUS:
case ESIO_STATUS: {
proto_item *hi = NULL;
if (tree) {
proto_tree_add_item(esio_tree,
hf_esio_sts_type, tvb, offset, 2, ENC_BIG_ENDIAN);
offset += 2;
proto_tree_add_item(esio_tree,
hf_esio_sts_size, tvb, offset, 2, ENC_BIG_ENDIAN);
offset += 2;
hf_esio_sts_size, tvb, offset+2, 2, ENC_BIG_ENDIAN);
proto_tree_add_item(esio_tree,
hf_esio_src_stn_id, tvb, offset, 4, ENC_BIG_ENDIAN);
offset += 4;
hf_esio_src_stn_id, tvb, offset+4, 4, ENC_BIG_ENDIAN);
proto_tree_add_item(esio_tree,
hf_esio_rio_sts, tvb, offset,
hf_esio_rio_sts, tvb, offset+8,
1, ENC_BIG_ENDIAN);
offset += 1;
hi = proto_tree_add_item(esio_tree,
hf_esio_rio_tlgs_lost, tvb, offset,
hf_esio_rio_tlgs_lost, tvb, offset+9,
1, ENC_BIG_ENDIAN);
proto_tree_add_item(esio_tree,
hf_esio_rio_diag, tvb, offset+10,
1, ENC_BIG_ENDIAN);
proto_tree_add_item(esio_tree,
hf_esio_rio_flags, tvb, offset+11, 1, ENC_BIG_ENDIAN);
} /* if (tree) */
if (tvb_get_guint8(tvb, offset + 9) > 0) {
expert_add_info_format(pinfo, hi, PI_SEQUENCE, PI_NOTE,
"Telegram(s) lost");
offset += 1;
proto_tree_add_item(esio_tree,
hf_esio_rio_diag, tvb, offset,
1, ENC_BIG_ENDIAN);
offset += 1;
proto_tree_add_item(esio_tree,
hf_esio_rio_flags, tvb, offset, 1, ENC_BIG_ENDIAN);
offset += 1;
break;
default:
}
break;
}
} /*end of tree*/
default:
break;
} /* switch() */
return tvb_length(tvb);
/*End of dissect_sbus*/
}