]> git.saurik.com Git - apt.git/blobdiff - apt-pkg/depcache.cc
* fix a bug when readStateFile is called with no OpProgress object
[apt.git] / apt-pkg / depcache.cc
index 05512e179d94d8267059f4b1a035b2c0a1987b37..366687382121aad69d04f4de9e20da089d4db955 100644 (file)
@@ -112,8 +112,9 @@ bool pkgDepCache::readStateFile(OpProgress *Prog)
    if(FileExists(state)) {
       state_file.Open(state, FileFd::ReadOnly);
       int file_size = state_file.Size();
-      Prog->OverallProgress(0, file_size, 1, 
-                           _("Reading state information"));
+      if(Prog != NULL)
+        Prog->OverallProgress(0, file_size, 1, 
+                              _("Reading state information"));
 
       pkgTagFile tagfile(&state_file);
       pkgTagSection section;
@@ -131,11 +132,13 @@ bool pkgDepCache::readStateFile(OpProgress *Prog)
               std::cout << "Install-Reason for: " << pkgname 
                         << " is " << reason << std::endl;
            amt+=section.size();
-           Prog->OverallProgress(amt, file_size, 1, 
-                                 _("Reading state information"));
+           if(Prog != NULL)
+              Prog->OverallProgress(amt, file_size, 1, 
+                                    _("Reading state information"));
         }
-        Prog->OverallProgress(file_size, file_size, 1, 
-                              _("Reading state information"));
+        if(Prog != NULL)
+           Prog->OverallProgress(file_size, file_size, 1, 
+                                 _("Reading state information"));
       }
    }