McuSupport: Prevent multiple packages writing to the same key

Writing with an empty settings key will result in multiple packages writing
their value in the same key "Package_", with the suffix missing,
overwriting each other.

Change-Id: Iee3e042a2d9d5d1f4e34b903360129ba25b6f6ea
Reviewed-by: <github-actions-qt-creator@cristianadam.eu>
Reviewed-by: Yasser Grimes <yasser.grimes@qt.io>
Reviewed-by: hjk <hjk@qt.io>
This commit is contained in:
Rainer Keller
2022-10-21 09:59:48 +02:00
committed by Rainer Keller
parent 42481ced35
commit 6493f2793f

View File

@@ -221,6 +221,12 @@ QString McuPackage::statusText() const
bool McuPackage::writeToSettings() const
{
if (m_settingsKey.isEmpty()) {
// Writing with an empty settings key will result in multiple packages writing their value
// in the same key "Package_", with the suffix missing, overwriting each other.
return false;
}
return settingsHandler->write(m_settingsKey, m_path, m_defaultPath);
}