Skip to content

Commit cc90a4f

Browse files
committed
Avoid potential null dereference in ReceiveCoinsDialog constructor
Not a bug in practice because current WalletModel::getDefaultAddressType() implementation does not dereference its `this` pointer.
1 parent c7978be commit cc90a4f

File tree

1 file changed

+9
-9
lines changed

1 file changed

+9
-9
lines changed

src/qt/receivecoinsdialog.cpp

Lines changed: 9 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -43,15 +43,6 @@ ReceiveCoinsDialog::ReceiveCoinsDialog(const PlatformStyle *_platformStyle, QWid
4343
ui->removeRequestButton->setIcon(_platformStyle->SingleColorIcon(":/icons/remove"));
4444
}
4545

46-
// configure bech32 checkbox, disable if launched with legacy as default:
47-
if (model->getDefaultAddressType() == OUTPUT_TYPE_BECH32) {
48-
ui->useBech32->setCheckState(Qt::Checked);
49-
} else {
50-
ui->useBech32->setCheckState(Qt::Unchecked);
51-
}
52-
53-
ui->useBech32->setVisible(model->getDefaultAddressType() != OUTPUT_TYPE_LEGACY);
54-
5546
// context menu actions
5647
QAction *copyURIAction = new QAction(tr("Copy URI"), this);
5748
QAction *copyLabelAction = new QAction(tr("Copy label"), this);
@@ -102,6 +93,15 @@ void ReceiveCoinsDialog::setModel(WalletModel *_model)
10293
SLOT(recentRequestsView_selectionChanged(QItemSelection, QItemSelection)));
10394
// Last 2 columns are set by the columnResizingFixer, when the table geometry is ready.
10495
columnResizingFixer = new GUIUtil::TableViewLastColumnResizingFixer(tableView, AMOUNT_MINIMUM_COLUMN_WIDTH, DATE_COLUMN_WIDTH, this);
96+
97+
// configure bech32 checkbox, disable if launched with legacy as default:
98+
if (model->getDefaultAddressType() == OUTPUT_TYPE_BECH32) {
99+
ui->useBech32->setCheckState(Qt::Checked);
100+
} else {
101+
ui->useBech32->setCheckState(Qt::Unchecked);
102+
}
103+
104+
ui->useBech32->setVisible(model->getDefaultAddressType() != OUTPUT_TYPE_LEGACY);
105105
}
106106
}
107107

0 commit comments

Comments
 (0)