summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--apt-pkg/deb/debsystem.cc16
1 files changed, 14 insertions, 2 deletions
diff --git a/apt-pkg/deb/debsystem.cc b/apt-pkg/deb/debsystem.cc
index c9c6a7e85..65a27f72f 100644
--- a/apt-pkg/deb/debsystem.cc
+++ b/apt-pkg/deb/debsystem.cc
@@ -335,8 +335,20 @@ signed debSystem::Score(Configuration const &Cnf)
/* */
bool debSystem::AddStatusFiles(std::vector<pkgIndexFile *> &List)
{
- if (d->StatusFile == 0)
- d->StatusFile = new debStatusIndex(_config->FindFile("Dir::State::status"));
+ if (d->StatusFile == nullptr)
+ {
+ auto dpkgstatus = _config->FindFile("Dir::State::status");
+ _error->PushToStack();
+ d->StatusFile = new debStatusIndex(std::move(dpkgstatus));
+ bool const errored = _error->PendingError();
+ _error->MergeWithStack();
+ if (errored)
+ {
+ delete d->StatusFile;
+ d->StatusFile = nullptr;
+ return false;
+ }
+ }
List.push_back(d->StatusFile);
return true;
}