summaryrefslogtreecommitdiff
path: root/apt-private/private-update.cc
diff options
context:
space:
mode:
authorJulian Andres Klode <jak@debian.org>2015-08-15 10:44:57 +0200
committerJulian Andres Klode <jak@debian.org>2015-08-15 10:46:34 +0200
commit7a139fa8bf2c18da54b5837c9290ba5b77e9c629 (patch)
treee06d04c511cdd2f30104bf3c20fc8897b44011b8 /apt-private/private-update.cc
parent7f97aa748270231d63b6419a271ba74029eebcd3 (diff)
update: Check if the cache could be opened, don't just assume it
This seems to cause Bug#756162, as in that case the depcache was NULL. I'm not entirely sure how that happens, but it's better to be check here rather then crash later on. Closes: #756162
Diffstat (limited to 'apt-private/private-update.cc')
-rw-r--r--apt-private/private-update.cc3
1 files changed, 2 insertions, 1 deletions
diff --git a/apt-private/private-update.cc b/apt-private/private-update.cc
index 73a82e988..1323771f0 100644
--- a/apt-private/private-update.cc
+++ b/apt-private/private-update.cc
@@ -84,7 +84,8 @@ bool DoUpdate(CommandLine &CmdL)
if (_config->FindB("APT::Cmd::Show-Update-Stats", false) == true)
{
int upgradable = 0;
- Cache.Open();
+ if (Cache.Open() == false)
+ return false;
for (pkgCache::PkgIterator I = Cache->PkgBegin(); I.end() != true; ++I)
{
pkgDepCache::StateCache &state = Cache[I];