summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorDominik Riebeling <Dominik.Riebeling@gmail.com>2007-08-30 16:55:04 +0000
committerDominik Riebeling <Dominik.Riebeling@gmail.com>2007-08-30 16:55:04 +0000
commit50af4dc0891385ad0ff7ae8ad9713f89b4014466 (patch)
treebfe5667c3ed013e21c6401195c153ac7652791ad
parent189de39258822f4976e71b5576280ba4ef937dab (diff)
When autodetecting, don't segfault if no item was previously selected and a device is found.
git-svn-id: svn://svn.rockbox.org/rockbox/trunk@14533 a1c6a512-1295-4272-9138-f99709370657
-rw-r--r--rbutil/rbutilqt/configure.cpp15
1 files changed, 9 insertions, 6 deletions
diff --git a/rbutil/rbutilqt/configure.cpp b/rbutil/rbutilqt/configure.cpp
index 05d0352498..49fa82f993 100644
--- a/rbutil/rbutilqt/configure.cpp
+++ b/rbutil/rbutilqt/configure.cpp
@@ -517,13 +517,16 @@ void Config::autodetect()
if(detector.detect()) //let it detect
{
QString devicename = detector.getDevice();
- //deexpand the platform
- ui.treeDevices->selectedItems().at(0)->parent()->setExpanded(false);
- //deselect the selected item
- ui.treeDevices->selectedItems().at(0)->setSelected(false);
+
+ if(ui.treeDevices->selectedItems().size() > 0) {
+ // deexpand the platform
+ ui.treeDevices->selectedItems().at(0)->parent()->setExpanded(false);
+ //deselect the selected item
+ ui.treeDevices->selectedItems().at(0)->setSelected(false);
+ }
// find the new item
- //enumerate al plattform items
+ // enumerate all platform items
QList<QTreeWidgetItem*> itmList= ui.treeDevices->findItems("*",Qt::MatchWildcard);
for(int i=0; i< itmList.size();i++)
{
@@ -532,7 +535,7 @@ void Config::autodetect()
{
QString data = itmList.at(i)->child(j)->data(0, Qt::UserRole).toString();
- if( devicename.contains(data)) //item found
+ if(devicename == data) // item found
{
itmList.at(i)->child(j)->setSelected(true); //select the item
itmList.at(i)->setExpanded(true); //expand the platform item