Commit 7335c281 authored by dt's avatar dt
Browse files

Fix a crash after removing all buildsteps.

parent 52145e0b
......@@ -266,12 +266,17 @@ void BuildStepsPage::stepMoveUp(int pos)
void BuildStepsPage::updateBuildStepButtonsState()
{
int pos = m_ui->buildSettingsList->currentIndex().row();
const QList<BuildStep *> &steps = m_clean ? m_pro->cleanSteps() : m_pro->buildSteps();
m_ui->buildStepRemoveToolButton->setEnabled(!steps.at(pos)->immutable());
bool enableUp = pos>0 && !(steps.at(pos)->immutable() && steps.at(pos-1)->immutable());
m_ui->buildStepUpToolButton->setEnabled(enableUp);
bool enableDown = pos < (m_ui->buildSettingsList->invisibleRootItem()->childCount() - 1) &&
!(steps.at(pos)->immutable() && steps.at(pos+1)->immutable());
m_ui->buildStepDownToolButton->setEnabled(enableDown);
if (pos == -1) {
m_ui->buildStepRemoveToolButton->setEnabled(false);
m_ui->buildStepUpToolButton->setEnabled(false);
m_ui->buildStepDownToolButton->setEnabled(false);
} else {
const QList<BuildStep *> &steps = m_clean ? m_pro->cleanSteps() : m_pro->buildSteps();
m_ui->buildStepRemoveToolButton->setEnabled(!steps.at(pos)->immutable());
bool enableUp = pos>0 && !(steps.at(pos)->immutable() && steps.at(pos-1)->immutable());
m_ui->buildStepUpToolButton->setEnabled(enableUp);
bool enableDown = pos < (m_ui->buildSettingsList->invisibleRootItem()->childCount() - 1) &&
!(steps.at(pos)->immutable() && steps.at(pos+1)->immutable());
m_ui->buildStepDownToolButton->setEnabled(enableDown);
}
}
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment