From 9f6fd7994e0247b75f910dc2f5e921548f7dd395 Mon Sep 17 00:00:00 2001 From: noctuum <25441068+noctuum@users.noreply.github.com> Date: Thu, 24 Sep 2026 15:42:01 +0500 Subject: [PATCH] Guard control in the main catch handlers A start without HOME throws before control is constructed. --- src/main.cc | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/src/main.cc b/src/main.cc index a16d93ac..980a2450 100644 --- a/src/main.cc +++ b/src/main.cc @@ -492,7 +492,8 @@ main(int argc, char** argv) { control->cleanup(); } catch (torrent::internal_error& e) { - control->cleanup_exception(); + if (control != nullptr) + control->cleanup_exception(); std::cout << "rtorrent: caught torrent::internal_error: " << e.what() << std::endl @@ -505,7 +506,8 @@ main(int argc, char** argv) { return -1; } catch (std::exception& e) { - control->cleanup_exception(); + if (control != nullptr) + control->cleanup_exception(); std::cout << "rtorrent: caught" << typeid(e).name() << " : " << e.what() << std::endl;