Skip to content

Commit

Permalink
Merge #2173: [GUI] Prevent invalid dashboard txs list filter value lo…
Browse files Browse the repository at this point in the history
…aded from settings

a3eea8c [GUI] guarding dashboard txs list filter load from settings against unknown values. (furszy)

Pull request description:

  Guard against any not expected `transactionType` value retrieved from the setting that doesn't map to any available filter type.

  Can be tested changing the value manually inside the settings file and starting the wallet again, the tx filter type combobox will be shown empty without this fix.

ACKs for top commit:
  random-zebra:
    utACK a3eea8c
  Fuzzbawls:
    utACK a3eea8c

Tree-SHA512: 615f88a9907a3f216de7a83a98233249b9c91b98d29ea6a9b212568c9a073ac63ec7ad4f4621006ef6597162892926476fd01ef1a373a5287276f10e24bbc963
  • Loading branch information
furszy committed Jan 30, 2021
2 parents c41ba08 + a3eea8c commit 70ac797
Showing 1 changed file with 3 additions and 3 deletions.
6 changes: 3 additions & 3 deletions src/qt/pivx/dashboardwidget.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -185,10 +185,10 @@ void DashboardWidget::loadWalletModel()

// Read filter settings
QSettings settings;
int filterByType = settings.value("transactionType", TransactionFilterProxy::ALL_TYPES).toInt();

filter->setTypeFilter(filterByType); // Set filter
quint32 filterByType = settings.value("transactionType", TransactionFilterProxy::ALL_TYPES).toInt();
int filterIndex = ui->comboBoxSortType->findData(filterByType); // Find index
filterByType = (filterIndex == -1) ? TransactionFilterProxy::ALL_TYPES : filterByType;
filter->setTypeFilter(filterByType); // Set filter
ui->comboBoxSortType->setCurrentIndex(filterIndex); // Set item in ComboBox

// Read sort settings
Expand Down

0 comments on commit 70ac797

Please sign in to comment.