[PC-BSD Commits] r1271 - pcbsd/trunk/kcmPBMsource

svn at pcbsd.org svn at pcbsd.org
Tue Jan 29 07:04:31 PST 2008


Author: kris
Date: 2008-01-29 07:04:31 -0800 (Tue, 29 Jan 2008)
New Revision: 1271

Modified:
   pcbsd/trunk/kcmPBMsource/pbm.ui.h
Log:

Fixed a bug in PBI removal tool to avoid crash if running when no PBI's are 
installed on system



Modified: pcbsd/trunk/kcmPBMsource/pbm.ui.h
===================================================================
--- pcbsd/trunk/kcmPBMsource/pbm.ui.h	2008-01-29 14:56:09 UTC (rev 1270)
+++ pcbsd/trunk/kcmPBMsource/pbm.ui.h	2008-01-29 15:04:31 UTC (rev 1271)
@@ -104,6 +104,7 @@
 void PBM::PopulateList()
 {
     PBI *pbi = 0;
+    int foundPBI = 0;
     SoftwareListBox->clear();
     QPixmap defaultIcon;
     defaultIcon.convertFromImage(QImage("/Programs/.config/application.png").smoothScale(40,40));
@@ -126,6 +127,7 @@
                     pbi = new PBI(defaultIcon);
 		    //ProgName[i] = line.replace("ProgName: ", "");
                     pbi->setName(line.replace("ProgName: ", ""));
+                    foundPBI = 1;
 		}
 		if ( line.find("ProgVer:") == 0)
 		{
@@ -175,8 +177,11 @@
         }
         file.close();
     }
-    SoftwareListBox->insertItem(pbi);
-    qDebug(pbi->text());
+    // Only insert the PBI into the list if we found some
+    if ( foundPBI == 1 ) {
+      SoftwareListBox->insertItem(pbi);
+      qDebug(pbi->text());
+    }
     SoftwareListBox->sort();
 }
 



More information about the Commits mailing list