Skip to content

Commit

Permalink
Fix nullptr dereference
Browse files Browse the repository at this point in the history
  • Loading branch information
KjellMorgenstern committed Nov 24, 2020
1 parent 8818b7d commit da06d0b
Showing 1 changed file with 8 additions and 5 deletions.
13 changes: 8 additions & 5 deletions src/dialogs/groundfillseeddialog.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -125,14 +125,17 @@ void GroundFillSeedDialog::changedSlot(QListWidgetItem *) {


void GroundFillSeedDialog::clickedSlot(QListWidgetItem * item) {

showEqualPotential(m_activeConnectorItem, false);

int ix = -1;
if (item != nullptr) {
if (item) {
ix = item->data(Qt::UserRole).toInt();
m_activeConnectorItem = m_connectorItems.value(ix, nullptr);
showEqualPotential(m_activeConnectorItem, item->checkState() == Qt::Checked);
} else {
m_activeConnectorItem = nullptr;
}

showEqualPotential(m_activeConnectorItem, false);
m_activeConnectorItem = (ix >= 0 && ix < m_connectorItems.count()) ? m_connectorItems.at(ix) : nullptr;
showEqualPotential(m_activeConnectorItem, item->checkState() == Qt::Checked);
}

void GroundFillSeedDialog::showEqualPotential(ConnectorItem * connectorItem, bool show)
Expand Down

0 comments on commit da06d0b

Please sign in to comment.