Merge pull request #10800 from Pokechu22/registerwidget-crash

RegisterWidget: Fix crash when right-clicking when there is no selected cell
This commit is contained in:
JosJuice 2022-07-02 09:18:28 +02:00 committed by GitHub
commit 2a791116f1
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
1 changed files with 3 additions and 3 deletions

View File

@ -114,11 +114,11 @@ void RegisterWidget::ShowContextMenu()
{
QMenu* menu = new QMenu(this);
auto variant = m_table->currentItem()->data(DATA_TYPE);
auto* raw_item = m_table->currentItem();
if (!variant.isNull())
if (raw_item != nullptr && !raw_item->data(DATA_TYPE).isNull())
{
auto* item = static_cast<RegisterColumn*>(m_table->currentItem());
auto* item = static_cast<RegisterColumn*>(raw_item);
auto type = static_cast<RegisterType>(item->data(DATA_TYPE).toInt());
auto display = item->GetDisplay();