android: Do not crash when node is nullptr in CreateAndroidManifectWizard

Change-Id: I1988fa72be535210e50d9ed18ef9d081e6ae39ed
Reviewed-by: BogDan Vatra <bogdan@kdab.com>
This commit is contained in:
Tobias Hunger
2020-02-24 11:08:55 +01:00
parent 2e59ef8c1c
commit 144ee4103f

View File

@@ -389,18 +389,21 @@ void CreateAndroidManifestWizard::createAndroidTemplateFiles()
if (node) {
node->addFiles(addedFiles);
androidPackageDir = node->data(Android::Constants::AndroidPackageSourceDir).toString();
}
if (androidPackageDir.isEmpty()) {
// and now time for some magic
const BuildTargetInfo bti = target->buildTarget(m_buildKey);
const QString value = "$$PWD/" + bti.projectFilePath.toFileInfo().absoluteDir().relativeFilePath(m_directory);
bool result = node->setData(Android::Constants::AndroidPackageSourceDir, value);
if (androidPackageDir.isEmpty()) {
// and now time for some magic
const BuildTargetInfo bti = target->buildTarget(m_buildKey);
const QString value = "$$PWD/"
+ bti.projectFilePath.toFileInfo().absoluteDir().relativeFilePath(
m_directory);
bool result = node->setData(Android::Constants::AndroidPackageSourceDir, value);
if (!result) {
QMessageBox::warning(this, tr("Project File not Updated"),
tr("Could not update the project file %1.")
.arg(bti.projectFilePath.toUserOutput()));
if (!result) {
QMessageBox::warning(this,
tr("Project File not Updated"),
tr("Could not update the project file %1.")
.arg(bti.projectFilePath.toUserOutput()));
}
}
}
Core::EditorManager::openEditor(m_directory + QLatin1String("/AndroidManifest.xml"));