Fix crash.

Valentina crashes if highlighted from history dialog tool was removed.
This commit is contained in:
Roman Telezhynskyi 2021-03-26 17:38:31 +02:00
parent 1be20e0b46
commit e4674f6058

View File

@ -87,8 +87,11 @@ DialogHistory::~DialogHistory()
void DialogHistory::DialogAccepted()
{
QTableWidgetItem *item = ui->tableWidget->item(cursorToolRecordRow, 0);
quint32 id = qvariant_cast<quint32>(item->data(Qt::UserRole));
emit ShowHistoryTool(id, false);
if (item != nullptr)
{
auto id = qvariant_cast<quint32>(item->data(Qt::UserRole));
emit ShowHistoryTool(id, false);
}
emit DialogClosed(QDialog::Accepted);
}