QtBT: avoid crash at exit if no BT device found

If localDevice isn't valid we never initialize the discory agent, so
let's not dereference it in the destructor unless it is valid.

Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
This commit is contained in:
Dirk Hohndel 2015-08-27 09:22:17 -07:00
parent 837daa08ea
commit 035e08e633

View file

@ -8,7 +8,8 @@
BtDeviceSelectionDialog::BtDeviceSelectionDialog(QWidget *parent) :
QDialog(parent),
ui(new Ui::BtDeviceSelectionDialog)
ui(new Ui::BtDeviceSelectionDialog),
remoteDeviceDiscoveryAgent(0)
{
ui->setupUi(this);
@ -92,6 +93,7 @@ BtDeviceSelectionDialog::~BtDeviceSelectionDialog()
// Clean the local device
delete localDevice;
#endif
if (remoteDeviceDiscoveryAgent) {
// Clean the device discovery agent
if (remoteDeviceDiscoveryAgent->isActive()) {
remoteDeviceDiscoveryAgent->stop();
@ -102,6 +104,7 @@ BtDeviceSelectionDialog::~BtDeviceSelectionDialog()
delete remoteDeviceDiscoveryAgent;
}
}
void BtDeviceSelectionDialog::on_changeDeviceState_clicked()
{