From 3bbef476f91fe0528c2a27ac31d91e8ca2f1ef4d Mon Sep 17 00:00:00 2001 From: Simon Quigley Date: Fri, 20 Dec 2024 00:53:05 -0600 Subject: [PATCH] Also try fixing current_series in distribution --- src/distribution.cpp | 7 ++++--- src/distribution.h | 5 +++-- 2 files changed, 7 insertions(+), 5 deletions(-) diff --git a/src/distribution.cpp b/src/distribution.cpp index 8db1869..ba48c54 100644 --- a/src/distribution.cpp +++ b/src/distribution.cpp @@ -14,6 +14,7 @@ // along with this program. If not, see . #include "distribution.h" +#include "distro_series.h" #include #include @@ -25,15 +26,15 @@ distribution::distribution() summary(""), domain_name(""), lp(nullptr), - current_series([this]() -> std::optional { - if (current_series_link.empty()) return std::nullopt; + current_series([this]() -> std::optional<::distro_series> { + if (!lp || current_series_link.empty()) return std::nullopt; if (_current_series) return _current_series; auto response = lp ? lp->api_get(current_series_link) : std::nullopt; if (!response) return std::nullopt; auto data = nlohmann::json::parse(response.value()); - auto ds = distro_series::parse(data.dump()); + auto ds = ::distro_series::parse(data.dump()); if (ds) { ds->set_lp(lp); diff --git a/src/distribution.h b/src/distribution.h index e5c5da7..741d106 100644 --- a/src/distribution.h +++ b/src/distribution.h @@ -69,14 +69,15 @@ public: std::string valid_specifications_collection_link; std::string vulnerabilities_collection_link; std::string webhooks_collection_link; - - lazy_optional()>> current_series; private: launchpad* lp; std::optional _current_series = std::nullopt; // JSON parsing utility void parse_json(const std::string& json_data); + +public: + lazy_optional()>> current_series; }; #endif // DISTRIBUTION_H