Skip to content

Commit

Permalink
Correct for segfault in variant access - use get_if non-throw
Browse files Browse the repository at this point in the history
  • Loading branch information
jamescowens committed Jan 4, 2024
1 parent 17ca5b1 commit a05a4bb
Showing 1 changed file with 5 additions and 2 deletions.
7 changes: 5 additions & 2 deletions src/qt/sidestaketablemodel.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -334,8 +334,11 @@ Qt::ItemFlags SideStakeTableModel::flags(const QModelIndex &index) const

Qt::ItemFlags retval = Qt::ItemIsSelectable | Qt::ItemIsEnabled;

if (!rec->IsMandatory()
&& std::get<GRC::LocalSideStake::Status>(rec->GetStatus()) == GRC::LocalSideStake::LocalSideStakeStatus::ACTIVE
GRC::SideStake::Status status = rec->GetStatus();
GRC::LocalSideStake::Status* local_status_ptr = std::get_if<GRC::LocalSideStake::Status>(&status);

if (!rec->IsMandatory() && local_status_ptr
&& *local_status_ptr == GRC::LocalSideStake::LocalSideStakeStatus::ACTIVE
&& (index.column() == Allocation || index.column() == Description)) {
retval |= Qt::ItemIsEditable;
}
Expand Down

0 comments on commit a05a4bb

Please sign in to comment.