[qet] qet/qet: [4868] Fix crash

[ Thread Index | Date Index | More lists.tuxfamily.org/qet Archives ]


Revision: 4868
Author:   blacksun
Date:     2017-01-22 17:47:18 +0100 (Sun, 22 Jan 2017)
Log Message:
-----------
Fix crash

Modified Paths:
--------------
    trunk/sources/ui/masterpropertieswidget.cpp

Modified: trunk/sources/ui/masterpropertieswidget.cpp
===================================================================
--- trunk/sources/ui/masterpropertieswidget.cpp	2017-01-22 13:48:58 UTC (rev 4867)
+++ trunk/sources/ui/masterpropertieswidget.cpp	2017-01-22 16:47:18 UTC (rev 4868)
@@ -260,10 +260,14 @@
 {
 		//take the curent item from free_list and push it to linked_list
 	QTreeWidgetItem *qtwi = ui->m_free_tree_widget->currentItem();
-	ui->m_free_tree_widget->takeTopLevelItem(ui->m_free_tree_widget->indexOfTopLevelItem(qtwi));
-	ui->m_link_tree_widget->insertTopLevelItem(0, qtwi);
-
-	if(m_live_edit) apply();
+	if (qtwi)
+	{
+		ui->m_free_tree_widget->takeTopLevelItem(ui->m_free_tree_widget->indexOfTopLevelItem(qtwi));
+		ui->m_link_tree_widget->insertTopLevelItem(0, qtwi);
+		
+		if(m_live_edit)
+			apply();
+	}
 }
 
 /**
@@ -274,10 +278,14 @@
 {
 		//take the curent item from linked_list and push it to free_list
 	QTreeWidgetItem *qtwi = ui->m_link_tree_widget->currentItem();
-	ui->m_link_tree_widget->takeTopLevelItem(ui->m_link_tree_widget->indexOfTopLevelItem(qtwi));
-	ui->m_free_tree_widget->insertTopLevelItem(0, qtwi);
+	if(qtwi)
+	{
+		ui->m_link_tree_widget->takeTopLevelItem(ui->m_link_tree_widget->indexOfTopLevelItem(qtwi));
+		ui->m_free_tree_widget->insertTopLevelItem(0, qtwi);
 
-	if(m_live_edit) apply();
+		if(m_live_edit)
+			apply();
+	}
 }
 
 /**


Mail converted by MHonArc 2.6.19+ http://listengine.tuxfamily.org/