Python: fix unguarded optional access

Change-Id: I4131343aab2f193336e81f2e76cbb95ef3ff2805
Reviewed-by: Christian Stenger <christian.stenger@qt.io>
This commit is contained in:
David Schulz
2023-09-07 13:38:03 +02:00
parent 445501e29e
commit 03e50d4d7a

View File

@@ -104,7 +104,7 @@ void PySideInstaller::installPyside(const FilePath &python,
if (success) if (success)
emit pySideInstalled(python, pySide); emit pySideInstalled(python, pySide);
}); });
if (qtInstallDir->isEmpty()) { if (availablePySides.isEmpty()) {
install->setPackages({PipPackage(pySide)}); install->setPackages({PipPackage(pySide)});
} else { } else {
QDialog dialog; QDialog dialog;
@@ -113,7 +113,7 @@ void PySideInstaller::installPyside(const FilePath &python,
dialog.layout()->addWidget(new QLabel(Tr::tr("Select which PySide version to install:"))); dialog.layout()->addWidget(new QLabel(Tr::tr("Select which PySide version to install:")));
QComboBox *pySideSelector = new QComboBox(); QComboBox *pySideSelector = new QComboBox();
pySideSelector->addItem(Tr::tr("Latest PySide from the Python Package Index")); pySideSelector->addItem(Tr::tr("Latest PySide from the Python Package Index"));
for (const Utils::FilePath &version : availablePySides) { for (const Utils::FilePath &version : std::as_const(availablePySides)) {
const FilePath dir = version.parentDir(); const FilePath dir = version.parentDir();
const QString text const QString text
= Tr::tr("PySide %1 wheel (%2)").arg(dir.fileName(), dir.toUserOutput()); = Tr::tr("PySide %1 wheel (%2)").arg(dir.fileName(), dir.toUserOutput());