From c7b94b652453de1414986a323fe6dc356c6afcad Mon Sep 17 00:00:00 2001 From: Guillaume Meunier Date: Sun, 26 Oct 2025 12:25:13 +0100 Subject: [PATCH] Handle errors when opening QFile --- dashboard/apk_installer.cpp | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-) diff --git a/dashboard/apk_installer.cpp b/dashboard/apk_installer.cpp index 288574d9..000b9223 100644 --- a/dashboard/apk_installer.cpp +++ b/dashboard/apk_installer.cpp @@ -131,7 +131,13 @@ QCoro::Task<> apk_installer::doInstallApk(QString serial) auto apk_dir = std::filesystem::path(m_apkFile.fileName().toStdString()).parent_path(); std::filesystem::create_directories(apk_dir); - m_apkFile.open(QIODeviceBase::WriteOnly | QIODeviceBase::Truncate); + if (not m_apkFile.open(QIODeviceBase::WriteOnly | QIODeviceBase::Truncate)) + { + qDebug() << "Cannot save APK file " << m_apkFile.fileName() << ": " << m_apkFile.errorString(); + installStatusChanged(m_installStatus = i18n("Cannot save APK file: %1", m_apkFile.errorString())); + busyChanged(m_busy = false); + co_return; + } qDebug() << "Downloading from" << m_apkUrl.toString() << "to" << m_apkFile.fileName();