Re: [linux-minidisc] netmd support for qhimdtransfer gui application
Hi,
i fixed a small bug in my last patch (netmd support for qhimdtransfer)
to prevent trying to perform any action on a NULL pointer.
Thomas
>From c33076f38f20ad545c6a60c4b92ac5eb0fa9f2e4 Mon Sep 17 00:00:00 2001
From: Thomas Arp <manner.moe@gmx.de>
Date: Fri, 20 Dec 2013 19:36:37 +0100
Subject: [PATCH 9/9] including netmd support into the gui application: check
if pointer to device to be closed exists before performing any actions on it
in QHiMDMainWindow::current_device_closed() function
---
qhimdtransfer/qhimdmainwindow.cpp | 8 ++++++--
1 file changed, 6 insertions(+), 2 deletions(-)
diff --git a/qhimdtransfer/qhimdmainwindow.cpp b/qhimdtransfer/qhimdmainwindow.cpp
index 588f3d1..a5c6e40 100644
--- a/qhimdtransfer/qhimdmainwindow.cpp
+++ b/qhimdtransfer/qhimdmainwindow.cpp
@@ -96,7 +96,7 @@ void QHiMDMainWindow::open_device(QMDDevice * dev)
int index = ui->himd_devices->currentIndex(); // remember current index of devices combo box, will be resetted by current_device_closed() function
- if (dev == NULL) // "disconnected" selected by the user
+ if (dev == NULL)
{
current_device_closed();
return;
@@ -309,7 +309,7 @@ void QHiMDMainWindow::on_himd_devices_activated(QString device)
if (index == 0) // disconnected
{
- open_device(NULL);
+ current_device_closed();
return;
}
@@ -320,6 +320,10 @@ void QHiMDMainWindow::on_himd_devices_activated(QString device)
void QHiMDMainWindow::current_device_closed()
{
int i;
+
+ if(!current_device)
+ return;
+
QString browser = current_device->deviceType() == NETMD_DEVICE ? "netmd_browser" : "himd_browser";
QMDTracksModel * mod = (QMDTracksModel *)ui->TrackList->model();
--
1.8.4.msysgit.0