Branch: r14.0.x

b06c73b1 2014-12-30 06:34:34 Slávek Banko
Fix crash when a network interface is removed
This resolves Bug 2278

Signed-off-by: Slávek Banko <slavek.banko@...>
(cherry picked from commit de063e3e84da8a8077eba18720ef4754a99f9afd)
M tdenetworkmanager/src/tdenetman-tray.cpp
diff --git a/tdenetworkmanager/src/tdenetman-tray.cpp b/tdenetworkmanager/src/tdenetman-tray.cpp
index 6b19a12..533fa7e 100644
--- a/tdenetworkmanager/src/tdenetman-tray.cpp
+++ b/tdenetworkmanager/src/tdenetman-tray.cpp
@@ -447,14 +447,15 @@
 
 			// remove the appropriate action
 			TDENetworkDevice* dev_comp_dev = dynamic_cast<TDENetworkDevice*>(hwdevices->findByUniqueID(dev_comp->device()));
-			TQString actionName = TQString("new_connection_%1").arg(dev_comp_dev->deviceNode());
-			TDEAction * deviceNewConnAction = actionCollection ()->action (actionName);
-			
-			if (!deviceNewConnAction)
-			{
-				delete deviceNewConnAction;
-				deviceNewConnAction = NULL;
+			if (dev_comp_dev) {
+				TQString actionName = TQString("new_connection_%1").arg(dev_comp_dev->deviceNode());
+				TDEAction * deviceNewConnAction = actionCollection ()->action (actionName);
+				if (!deviceNewConnAction) {
+					delete deviceNewConnAction;
+					deviceNewConnAction = NULL;
+				}
 			}
+
 			// remove device_tray and delete it
 			d->trayComponents.remove(it);
 			delete dev_comp;