From 1b1e4e4d43559aeb13555034430511898338adf4 Mon Sep 17 00:00:00 2001 From: Assam Boudjelthia Date: Sun, 20 Oct 2024 15:08:17 +0300 Subject: [PATCH] Android: check manifest existence before reading content It's looks to me that the manifest file might be opened from various places to get the package name or activity name, that can happen before the manifest file is even written or copied from templates. Also, the warning message added to the "General Messages" is not super informative about what task is reading the file, so in many cases the those general messages section can end up filled with such messages. Instead make it leave it to the calling task to fail with its error when the returned content is not valid. Change-Id: I4e326e15e628e3abfe7b63ffef02d84cf478e377 Reviewed-by: Jarek Kobus --- src/plugins/android/androidmanager.cpp | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/src/plugins/android/androidmanager.cpp b/src/plugins/android/androidmanager.cpp index 9171acc0016..f11eb0b1e89 100644 --- a/src/plugins/android/androidmanager.cpp +++ b/src/plugins/android/androidmanager.cpp @@ -54,6 +54,12 @@ static Q_LOGGING_CATEGORY(androidManagerLog, "qtc.android.androidManager", QtWar static std::optional documentElement(const FilePath &fileName) { + if (!fileName.exists()) { + qCDebug(androidManagerLog, "Manifest file %s doesn't exist.", + fileName.toUserOutput().toUtf8().data()); + return {}; + } + const expected_str result = fileName.fileContents(); if (!result) { MessageManager::writeDisrupting(Tr::tr("Cannot open \"%1\".")