From 9c8ba7f9977d26ad015e83c0b5324e7bd432e77a Mon Sep 17 00:00:00 2001 From: Roman Telezhynskyi Date: Fri, 1 Mar 2024 14:32:19 +0200 Subject: [PATCH] Fix crash in History dialog. --- src/app/valentina/dialogs/dialoghistory.cpp | 9 ++++++--- 1 file changed, 6 insertions(+), 3 deletions(-) diff --git a/src/app/valentina/dialogs/dialoghistory.cpp b/src/app/valentina/dialogs/dialoghistory.cpp index 62f348492..1cc3e7e59 100644 --- a/src/app/valentina/dialogs/dialoghistory.cpp +++ b/src/app/valentina/dialogs/dialoghistory.cpp @@ -151,12 +151,15 @@ void DialogHistory::cellClicked(int row, int column) else { QTableWidgetItem *item = ui->tableWidget->item(m_cursorToolRecordRow, 0); - auto id = qvariant_cast(item->data(Qt::UserRole)); - emit ShowHistoryTool(id, false); + if (item != nullptr) + { + auto id = qvariant_cast(item->data(Qt::UserRole)); + emit ShowHistoryTool(id, false); + } m_cursorToolRecordRow = row; item = ui->tableWidget->item(m_cursorToolRecordRow, 0); - id = qvariant_cast(item->data(Qt::UserRole)); + auto id = qvariant_cast(item->data(Qt::UserRole)); emit ShowHistoryTool(id, true); } }