From dd8f41140f613f744870b991ac81cb871c206cc0 Mon Sep 17 00:00:00 2001 From: Simon Quigley Date: Thu, 19 Dec 2024 00:29:48 -0600 Subject: [PATCH] Rearrange variables to finally fix distro_series segfault --- src/source_package_publishing_history.cpp | 2 +- src/source_package_publishing_history.h | 8 +++++--- 2 files changed, 6 insertions(+), 4 deletions(-) diff --git a/src/source_package_publishing_history.cpp b/src/source_package_publishing_history.cpp index d666679..ab0e3be 100644 --- a/src/source_package_publishing_history.cpp +++ b/src/source_package_publishing_history.cpp @@ -29,7 +29,7 @@ source_package_publishing_history::source_package_publishing_history() lp(nullptr), _distro_series(std::nullopt), distro_series([this]() -> std::optional<::distro_series> { - if (distro_series_link.empty()) return std::nullopt; + if (!lp || distro_series_link.empty()) return std::nullopt; if (_distro_series) return _distro_series; auto response = lp ? lp->api_get(distro_series_link) : std::nullopt; diff --git a/src/source_package_publishing_history.h b/src/source_package_publishing_history.h index 8fa2be7..431a385 100644 --- a/src/source_package_publishing_history.h +++ b/src/source_package_publishing_history.h @@ -53,12 +53,14 @@ public: std::string source_package_name; std::string source_package_version; - void set_lp(launchpad* lp_ptr); - lazy_optional<::distro_series, std::function()>> distro_series; - private: launchpad* lp; std::optional<::distro_series> _distro_series = std::nullopt; + +public: + void set_lp(launchpad* lp_ptr); + lazy_optional<::distro_series, std::function()>> distro_series; + }; #endif // SOURCE_PACKAGE_PUBLISHING_HISTORY