Browse Source

Fix crash in "apt list" when a sources.list file is unreable

Closes: 743413
Michael Vogt 10 years ago
parent
commit
ec4371acb7
3 changed files with 4 additions and 5 deletions
  1. 2 3
      apt-private/private-list.cc
  2. 1 1
      apt-private/private-list.h
  3. 1 1
      cmdline/apt.cc

+ 2 - 3
apt-private/private-list.cc

@@ -99,14 +99,13 @@ static void ListAllVersions(pkgCacheFile &CacheFile, pkgRecords &records,/*{{{*/
 									/*}}}*/
 // list - list package based on criteria        			/*{{{*/
 // ---------------------------------------------------------------------
-bool List(CommandLine &Cmd)
+bool DoList(CommandLine &Cmd)
 {
    pkgCacheFile CacheFile;
    pkgCache *Cache = CacheFile.GetPkgCache();
-   pkgRecords records(CacheFile);
-
    if (unlikely(Cache == NULL))
       return false;
+   pkgRecords records(CacheFile);
 
    const char **patterns;
    const char *all_pattern[] = { "*", NULL};

+ 1 - 1
apt-private/private-list.h

@@ -5,7 +5,7 @@
 
 class CommandLine;
 
-APT_PUBLIC bool List(CommandLine &Cmd);
+APT_PUBLIC bool DoList(CommandLine &Cmd);
 
 
 #endif

+ 1 - 1
cmdline/apt.cc

@@ -70,7 +70,7 @@ int main(int argc, const char *argv[])					/*{{{*/
 {
    CommandLine::Dispatch Cmds[] = {
                                    // query
-                                   {"list",&List},
+                                   {"list",&DoList},
                                    {"search", &FullTextSearch},
                                    {"show", &APT::Cmd::ShowPackage},