Skip to content

Commit 601ddd9

Browse files
committed
ProjectManagerPlugin: fix crash when no kits are found
I found this bug in a live session of Debian. I used the appimage, and did not understand why the app crashed. I manged to trace it down in a Win10 installation, that uses mingw (which is a pain to debug, as it did not catch the exception, and debugging loading takes about a minute). Anyway, when no kits are available, at startup the combo box of the kits will be set to 0, and will de-reference. Its actually an out of boundery - we try to get element "0" when we have no elements. Just did an if, and code no longer crashes. Doing a rescan should be done as a first step - see https://github.com/ /issues/25
1 parent 8b84c1f commit 601ddd9

1 file changed

Lines changed: 4 additions & 0 deletions

File tree

src/plugins/ProjectManager/ProjectManagerPlg.cpp

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -583,6 +583,10 @@ void ProjectManagerPlugin::on_client_merged(qmdiHost *host) {
583583

584584
gui->kitComboBox->setModel(kitsModel);
585585
connect(gui->kitComboBox, &QComboBox::activated, gui->kitComboBox, [this](int newIndex) {
586+
if (kitsModel->rowCount() <= newIndex) {
587+
qDebug() << "kitComboBox: No kits found, or wrong kit definted.";
588+
return;
589+
}
586590
auto kit = kitsModel->getKit(newIndex);
587591
auto tooltip = QString("%1\n%2").arg(QString::fromStdString(kit.name),
588592
QString::fromStdString(kit.filePath));

0 commit comments

Comments
 (0)