From 12b69a4c618f949e27a4c0ca8e09d27515acf219 Mon Sep 17 00:00:00 2001 From: Horror Proton <107091537+horror-proton@users.noreply.github.com> Date: Fri, 27 Oct 2023 14:41:38 +0800 Subject: [PATCH] fix: coredump after failing to restart minitouch --- src/MaaCore/Controller/MinitouchController.cpp | 5 ++--- 1 file changed, 2 insertions(+), 3 deletions(-) diff --git a/src/MaaCore/Controller/MinitouchController.cpp b/src/MaaCore/Controller/MinitouchController.cpp index b1ef5d5819..8b7394e496 100644 --- a/src/MaaCore/Controller/MinitouchController.cpp +++ b/src/MaaCore/Controller/MinitouchController.cpp @@ -111,10 +111,9 @@ std::optional asst::MinitouchController::reconnect(const std::strin bool asst::MinitouchController::input_to_minitouch(const std::string& cmd) { - if (!m_minitouch_handler->write(cmd)) { + if (!(m_minitouch_handler && m_minitouch_handler->write(cmd))) { Log.error("Failed to write to minitouch, try restart minitouch and re-write"); - call_and_hup_minitouch(); - return m_minitouch_handler->write(cmd); + return call_and_hup_minitouch() && m_minitouch_handler->write(cmd); } return true; }