Browse Source

Merge #12074: [qt] Optimizes boolean expression model && model->haveWatchOnly()

6dda059bd [qt] Simplifies boolean expression model && model->haveWatchOnly() (251)

Pull request description:

  This PR optimizes the boolean expression `model && model->haveWatchOnly()` to `model->haveWatchOnly()`.

  The boolean expression can be optimized because the method `TransactionView::exportClicked` already guards against a potential dereferenced null pointer by returning early if `model` is null.
  63a4dc1087/src/qt/transactionview.cpp (L351-L353)

Tree-SHA512: 8bdd0d05bf879745fa39d3ca7524471720ae08ceee9427d5a08776e7b56d18542ae87a6991cd6779e232305f504fdfc77223702b72ecbe231f5f5e98453456dd
0.16
Jonas Schnelli 7 years ago
parent
commit
a1136f0cb4
No known key found for this signature in database
GPG Key ID: 1EB776BB03C7922D
  1. 2
      src/qt/transactionview.cpp

2
src/qt/transactionview.cpp

@ -365,7 +365,7 @@ void TransactionView::exportClicked()
// name, column, role // name, column, role
writer.setModel(transactionProxyModel); writer.setModel(transactionProxyModel);
writer.addColumn(tr("Confirmed"), 0, TransactionTableModel::ConfirmedRole); writer.addColumn(tr("Confirmed"), 0, TransactionTableModel::ConfirmedRole);
if (model && model->haveWatchOnly()) if (model->haveWatchOnly())
writer.addColumn(tr("Watch-only"), TransactionTableModel::Watchonly); writer.addColumn(tr("Watch-only"), TransactionTableModel::Watchonly);
writer.addColumn(tr("Date"), 0, TransactionTableModel::DateRole); writer.addColumn(tr("Date"), 0, TransactionTableModel::DateRole);
writer.addColumn(tr("Type"), TransactionTableModel::Type, Qt::EditRole); writer.addColumn(tr("Type"), TransactionTableModel::Type, Qt::EditRole);

Loading…
Cancel
Save