summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--gentoobrowse/src/packages.cpp24
1 files changed, 14 insertions, 10 deletions
diff --git a/gentoobrowse/src/packages.cpp b/gentoobrowse/src/packages.cpp
index c6e01fb..3ef592d 100644
--- a/gentoobrowse/src/packages.cpp
+++ b/gentoobrowse/src/packages.cpp
@@ -58,21 +58,25 @@ namespace GentooBrowse {
if (_responseModel->user) {
_ar_t = prx1->trackedAsync(_responseModel->user->userid);
}
- auto ebuilds = _ar_ebuilds.get();
- auto packages = GentooBrowse::makeMap<Ice::Int, Gentoo::PackagePtr>(_ar_packages.get(), [](auto p){ return p->packageid; });
- auto categories = GentooBrowse::makeMap<Ice::Int, Gentoo::CategoryPtr>(_ar_categories.get(), [](auto c){ return c->categoryid; });
+ const auto ebuilds = _ar_ebuilds.get();
+ const auto packages = GentooBrowse::makeMap<Ice::Int, Gentoo::PackagePtr>(_ar_packages.get(), [](auto p){ return p->packageid; });
+ const auto categories = GentooBrowse::makeMap<Ice::Int, Gentoo::CategoryPtr>(_ar_categories.get(), [](auto c){ return c->categoryid; });
::Gentoo::PackageIds tracked;
if (_responseModel->user) {
tracked = _ar_t.get();
}
for(const auto & ebuild : ebuilds) {
- auto & p = packages[ebuild->packageid];
- auto & c = categories[p->categoryid];
- auto & s = _responseModel->syncs[ebuild->firstseen.substr(0, 10)];
- bool isTracked = std::find(tracked.begin(), tracked.end(), p->packageid) != tracked.end();
- auto & pw = s[{ isTracked, c->name }][{ isTracked, p->name }];
- if (!pw.detail) pw.detail = p;
- pw.ebuilds.push_back(ebuild);
+ if (auto pi = packages.find(ebuild->packageid); pi != packages.end()) {
+ auto & p = pi->second;
+ if (auto ci = categories.find(p->categoryid); ci != categories.end()) {
+ auto & c = ci->second;
+ auto & s = _responseModel->syncs[ebuild->firstseen.substr(0, 10)];
+ bool isTracked = std::find(tracked.begin(), tracked.end(), p->packageid) != tracked.end();
+ auto & pw = s[{ isTracked, c->name }][{ isTracked, p->name }];
+ if (!pw.detail) pw.detail = p;
+ pw.ebuilds.push_back(ebuild);
+ }
+ }
}
request->response(this, _responseModel);
}