Quellcode durchsuchen

apt-pkg/sourcelist.cc: GetListOfFilesInDir() fails if the dir does not exists, so test before using that

Michael Vogt vor 15 Jahren
Ursprung
Commit
5e7b0aa9eb
1 geänderte Dateien mit 6 neuen und 2 gelöschten Zeilen
  1. 6 2
      apt-pkg/sourcelist.cc

+ 6 - 2
apt-pkg/sourcelist.cc

@@ -346,10 +346,14 @@ bool pkgSourceList::ReadSourceDir(string Dir)
 /* */
 time_t pkgSourceList::GetLastModifiedTime()
 {
-   // go over the parts
+   vector<string> List;
+
    string Main = _config->FindFile("Dir::Etc::sourcelist");
    string Parts = _config->FindDir("Dir::Etc::sourceparts");
-   vector<string> const List = GetListOfFilesInDir(Parts, "list", true);
+
+   // go over the parts
+   if (DirectoryExists(Parts) == true)
+      List = GetListOfFilesInDir(Parts, "list", true);
 
    // calculate the time
    time_t mtime_sources = GetModificationTime(Main);