Get rid of duplicate code.

Use CHECK_FOR_NULL_TREE() while we're at it, to make it more like other
routines.

Change-Id: I2cbdf9f043583fd0c9858e94ae1134173a68c875
Reviewed-on: https://code.wireshark.org/review/15116
Reviewed-by: Guy Harris <guy@alum.mit.edu>
This commit is contained in:
Guy Harris 2016-04-25 17:41:49 -07:00
parent 7b2d8a16c5
commit ca57399db8
1 changed files with 2 additions and 9 deletions

View File

@ -2443,18 +2443,11 @@ ptvcursor_add(ptvcursor_t *ptvc, int hfindex, gint length,
get_hfi_length(hfinfo, ptvc->tvb, offset, &length, &item_length);
test_length(hfinfo, ptvc->tvb, offset, item_length);
if (!ptvc->tree) {
ptvc->offset += get_full_length(hfinfo, ptvc->tvb, offset,
length, item_length, encoding);
return NULL;
}
offset = ptvc->offset;
PROTO_REGISTRAR_GET_NTH(hfindex, hfinfo);
get_hfi_length(hfinfo, ptvc->tvb, offset, &length, &item_length);
ptvc->offset += get_full_length(hfinfo, ptvc->tvb, offset, length,
item_length, encoding);
CHECK_FOR_NULL_TREE(ptvc->tree);
/* Coast clear. Try and fake it */
TRY_TO_FAKE_THIS_ITEM(ptvc->tree, hfindex, hfinfo);