Qt: fix a NULL pointer dereference in extcap_argument_multiselect.cpp

Guard treeView dereference by a cehck on viewModel (as it is done elsewhere in
the file, both are allocated at the same time).
This can happen for example when USBPcap lists a USB Hub with no devices connected.

Change-Id: Iee412b8c95539e9e3d65706c14f62194cafcaffc
Reviewed-on: https://code.wireshark.org/review/16885
Reviewed-by: Pascal Quantin <pascal.quantin@gmail.com>
Petri-Dish: Pascal Quantin <pascal.quantin@gmail.com>
Reviewed-by: Roland Knall <rknall@gmail.com>
This commit is contained in:
Pascal Quantin 2016-08-04 17:01:45 +02:00 committed by Roland Knall
parent d21295f9a6
commit 6168d8bf80
1 changed files with 2 additions and 1 deletions

View File

@ -198,7 +198,8 @@ bool ExtArgMultiSelect::isValid()
QString lblInvalidColor = ColorUtils::fromColorT(prefs.gui_text_invalid).name();
QString txtStyle("QTreeView { background-color: %1; } ");
treeView->setStyleSheet( txtStyle.arg(valid ? QString("") : lblInvalidColor) );
if ( viewModel != 0 )
treeView->setStyleSheet( txtStyle.arg(valid ? QString("") : lblInvalidColor) );
return valid;
}