Qt: do not crash when selecting a field without tvb

If no tvb is attached to a field, crashing is not the expected result.

Change-Id: Ica0e95326cfcfeb015016770d1b930a9f0447066
Fixes: v2.5.0rc0-1627-g8a6ea0e454 ("Qt: Further cleanup ByteView")
Ping-Bug: 14205
Reviewed-on: https://code.wireshark.org/review/24370
Petri-Dish: Peter Wu <peter@lekensteyn.nl>
Tested-by: Petri Dish Buildbot
Reviewed-by: Roland Knall <rknall@gmail.com>
This commit is contained in:
Peter Wu 2017-11-12 04:00:56 +00:00 committed by Roland Knall
parent 5bd8fb4131
commit e95623cd6b
1 changed files with 2 additions and 2 deletions

View File

@ -88,7 +88,7 @@ bool FieldInformation::tvbContains(FieldInformation *child)
FieldInformation::Position FieldInformation::position() const
{
Position pos = {-1, -1, -1};
if ( fi_ )
if ( fi_ && fi_->ds_tvb )
{
guint len = tvb_captured_length(fi_->ds_tvb);
@ -118,7 +118,7 @@ FieldInformation::Position FieldInformation::position() const
FieldInformation::Position FieldInformation::appendix() const
{
Position pos = {-1, -1, -1};
if ( fi_ )
if ( fi_ && fi_->ds_tvb )
{
guint len = tvb_captured_length(fi_->ds_tvb);