Rows in list can't be more than count();

--HG--
branch : develop
This commit is contained in:
Roman Telezhynskyi 2015-02-25 20:21:44 +02:00
parent cdeddbfa1e
commit 924af81eae

View File

@ -340,11 +340,12 @@ void DialogDetail::ClickedReverse(bool checked)
*/ */
void DialogDetail::ObjectChanged(int row) void DialogDetail::ObjectChanged(int row)
{ {
if (ui.listWidget->count() == 0 || row == -1) if (ui.listWidget->count() == 0 || row == -1 || row >= ui.listWidget->count())
{ {
return; return;
} }
const QListWidgetItem *item = ui.listWidget->item( row ); const QListWidgetItem *item = ui.listWidget->item( row );
SCASSERT(item != nullptr);
const VNodeDetail node = qvariant_cast<VNodeDetail>(item->data(Qt::UserRole)); const VNodeDetail node = qvariant_cast<VNodeDetail>(item->data(Qt::UserRole));
ui.doubleSpinBoxBiasX->setValue(qApp->fromPixel(node.getMx())); ui.doubleSpinBoxBiasX->setValue(qApp->fromPixel(node.getMx()));
ui.doubleSpinBoxBiasY->setValue(qApp->fromPixel(node.getMy())); ui.doubleSpinBoxBiasY->setValue(qApp->fromPixel(node.getMy()));