Merge pull request #6559 from spycrab/qt_crashes

Qt/PatchesWidget: Fix segfault
This commit is contained in:
Mat M 2018-03-29 18:51:22 -04:00 committed by GitHub
commit c3398c9e2c
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
1 changed files with 2 additions and 1 deletions

View File

@ -169,7 +169,8 @@ void PatchesWidget::Update()
void PatchesWidget::UpdateActions() void PatchesWidget::UpdateActions()
{ {
bool selected = !m_list->selectedItems().isEmpty(); bool selected = !m_list->selectedItems().isEmpty();
auto* item = m_list->selectedItems()[0];
auto* item = selected ? m_list->selectedItems()[0] : nullptr;
bool user_defined = selected ? item->data(Qt::UserRole).toBool() : true; bool user_defined = selected ? item->data(Qt::UserRole).toBool() : true;