Guard control in the main catch handlers

A start without HOME throws before control is constructed.
This commit is contained in:
noctuum
2026-09-24 15:42:01 +05:00
committed by Jari Sundell
parent bb77aa644c
commit 9f6fd7994e
+2
View File
@@ -492,6 +492,7 @@ main(int argc, char** argv) {
control->cleanup(); control->cleanup();
} catch (torrent::internal_error& e) { } catch (torrent::internal_error& e) {
if (control != nullptr)
control->cleanup_exception(); control->cleanup_exception();
std::cout << "rtorrent: caught torrent::internal_error: " std::cout << "rtorrent: caught torrent::internal_error: "
@@ -505,6 +506,7 @@ main(int argc, char** argv) {
return -1; return -1;
} catch (std::exception& e) { } catch (std::exception& e) {
if (control != nullptr)
control->cleanup_exception(); control->cleanup_exception();
std::cout << "rtorrent: caught" << typeid(e).name() << " : " << e.what() << std::endl; std::cout << "rtorrent: caught" << typeid(e).name() << " : " << e.what() << std::endl;