X-Git-Url: https://git.saurik.com/apt.git/blobdiff_plain/03d6de04fb366127d950cc484317d0e7ddebaa75..f74d99c6a78caafdc6e32d8cb135683b7154795c:/apt-private/private-show.cc diff --git a/apt-private/private-show.cc b/apt-private/private-show.cc index d28387ba9..03229476e 100644 --- a/apt-private/private-show.cc +++ b/apt-private/private-show.cc @@ -258,6 +258,8 @@ bool ShowPackage(CommandLine &CmdL) /*{{{*/ CacheSetHelperVirtuals helper(true, GlobalError::NOTICE); APT::CacheSetHelper::VerSelector const select = _config->FindB("APT::Cache::AllVersions", true) ? APT::CacheSetHelper::ALL : APT::CacheSetHelper::CANDIDATE; + if (select == APT::CacheSetHelper::CANDIDATE && CacheFile.GetDepCache() == nullptr) + return false; APT::VersionList const verset = APT::VersionList::FromCommandLine(CacheFile, CmdL.FileList + 1, select, helper); int const ShowVersion = _config->FindI("APT::Cache::Show::Version", 1); for (APT::VersionList::const_iterator Ver = verset.begin(); Ver != verset.end(); ++Ver) @@ -356,10 +358,14 @@ bool ShowSrcPackage(CommandLine &CmdL) /*{{{*/ bool Policy(CommandLine &CmdL) { pkgCacheFile CacheFile; - pkgCache *Cache = CacheFile.GetPkgCache(); - pkgPolicy *Plcy = CacheFile.GetPolicy(); - pkgSourceList *SrcList = CacheFile.GetSourceList(); - if (unlikely(Cache == NULL || Plcy == NULL || SrcList == NULL)) + pkgSourceList const * const SrcList = CacheFile.GetSourceList(); + if (unlikely(SrcList == nullptr)) + return false; + pkgCache * const Cache = CacheFile.GetPkgCache(); + if (unlikely(Cache == nullptr)) + return false; + pkgPolicy * const Plcy = CacheFile.GetPolicy(); + if (unlikely(Plcy == nullptr)) return false; // Print out all of the package files