[PC-BSD Commits] r17766 - pcbsd/current/src-qt4/EasyPBI

svn at pcbsd.org svn at pcbsd.org
Mon Jul 16 09:34:25 PDT 2012


Author: kenmoore
Date: 2012-07-16 16:34:25 +0000 (Mon, 16 Jul 2012)
New Revision: 17766

Modified:
   pcbsd/current/src-qt4/EasyPBI/mainwindow.cpp
   pcbsd/current/src-qt4/EasyPBI/modBuild.cpp
Log:
Fix a bug in EasyPBI that causes a bus error if it loads a module that was created without a PBI_PROGICON set.



Modified: pcbsd/current/src-qt4/EasyPBI/mainwindow.cpp
===================================================================
--- pcbsd/current/src-qt4/EasyPBI/mainwindow.cpp	2012-07-16 15:31:52 UTC (rev 17765)
+++ pcbsd/current/src-qt4/EasyPBI/mainwindow.cpp	2012-07-16 16:34:25 UTC (rev 17766)
@@ -631,6 +631,7 @@
   ui->listNewProgIcon->clear();
   QString progicon = ModBuild::getFilenameFromPath(ModBuild::readValue("PBI_PROGICON"));
   QString progiconpath = ui->label_module_selected->text() +"/resources/"+progicon;
+  if(!(QFile::exists(progiconpath) && progiconpath.endsWith(".png")) ){ progiconpath=""; } //Make sure that icon file exists
   ui->listNewProgIcon->addItem(QIcon(progiconpath),progicon);
   ui->listNewProgIcon->setCurrentIndex(0);
   //Get all the .png files in the resources directory and add them to the list
@@ -840,6 +841,7 @@
   QFileInfoList fileList = dir.entryInfoList(QStringList("*.desktop"));
   for(int i=0; i<fileList.length(); i++){ 
       QString icon = ui->label_module_selected->text()+"/resources/"+ModBuild::getDesktopEntryValue(fileList[i].absoluteFilePath(),"icon",TRUE);
+      if(!(QFile::exists(icon) && icon.endsWith(".png")) ){ icon=""; } //Make sure that icon file exists
       QListWidgetItem *item = new QListWidgetItem( QIcon(icon),fileList[i].fileName() );
       ui->listDesktopEntries->addItem(item);
   }
@@ -849,6 +851,7 @@
   fileList = dir.entryInfoList(QStringList("*.desktop"));
   for(int i=0; i<fileList.length(); i++){
       QString icon = ui->label_module_selected->text()+"/resources/"+ModBuild::getMenuEntryValue(fileList[i].absoluteFilePath(),"icon",TRUE);
+      if(!(QFile::exists(icon) && icon.endsWith(".png")) ){ icon=""; } //Make sure that icon file exists
       QListWidgetItem *item = new QListWidgetItem( QIcon(icon),fileList[i].fileName() );
       ui->listMenuEntries->addItem(item);
   }

Modified: pcbsd/current/src-qt4/EasyPBI/modBuild.cpp
===================================================================
--- pcbsd/current/src-qt4/EasyPBI/modBuild.cpp	2012-07-16 15:31:52 UTC (rev 17765)
+++ pcbsd/current/src-qt4/EasyPBI/modBuild.cpp	2012-07-16 16:34:25 UTC (rev 17766)
@@ -466,6 +466,7 @@
 }
 
 QString ModBuild::getFilenameFromPath(QString fullPath){
+  if(fullPath.isEmpty()){return "";}
   QStringList entries = fullPath.split("/",QString::SkipEmptyParts);
   QString name = entries[entries.length() - 1]; //only take the last entry
   return name;



More information about the Commits mailing list