summaryrefslogtreecommitdiff
Side-by-side diff
Diffstat (more/less context) (show whitespace changes)
-rw-r--r--noncore/settings/aqpkg/server.cpp6
1 files changed, 4 insertions, 2 deletions
diff --git a/noncore/settings/aqpkg/server.cpp b/noncore/settings/aqpkg/server.cpp
index 04f5ab7..06b0863 100644
--- a/noncore/settings/aqpkg/server.cpp
+++ b/noncore/settings/aqpkg/server.cpp
@@ -144,54 +144,56 @@ void Server :: readLocalIpks( Server *local )
buildLocalPackages( local );
}
void Server :: readPackageFile( Server *local, bool clearAll, bool installingToRoot, Destination *dest )
{
ifstream in( packageFile );
if ( !in.is_open() )
return;
char line[1001];
char k[21];
char v[1001];
QString key;
QString value;
if ( clearAll )
cleanUp();
Package *currPackage = 0;
bool newPackage = true;
do
{
in.getline( line, 1000 );
if ( in.eof() )
- continue;
+ break;
k[0] = '\0';
v[0] = '\0';
- sscanf( line, "%[^:]: %[^\n]", k, v );
+ if ( sscanf( line, "%[^:]: %[^\n]", k, v ) < 2 )
+ break;
+
key = k;
value = v;
key = key.stripWhiteSpace();
value = value.stripWhiteSpace();
if ( key == "Package" && newPackage )
{
newPackage = false;
currPackage = getPackage( value );
if ( !currPackage )
{
Package *package = new Package( value );
packageList.append( package );
currPackage = package;
currPackage->setInstalledTo( dest );
if ( installingToRoot )
currPackage->setInstalledToRoot( true );
}
else
{
if (currPackage->getStatus().find( "deinstall" ) != -1 )
currPackage->setInstalledTo( dest );
}
}