fix(qt): fix crash when first enabling governance tab due to null-ptr deref (#4795)

Decided to also apply the same logic to the other items so that we don't do nullptr dereferences

replication
```
./src/qt/dash-qt --regtest --resetguisettings
Enable governance
shutdown
```
This commit is contained in:
PastaPastaPasta 2022-04-21 17:01:29 -05:00 committed by GitHub
parent 11a0fd7773
commit 685c122fef
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -153,14 +153,20 @@ void WalletView::setClientModel(ClientModel *_clientModel)
{
this->clientModel = _clientModel;
if (overviewPage != nullptr) {
overviewPage->setClientModel(_clientModel);
}
if (sendCoinsPage != nullptr) {
sendCoinsPage->setClientModel(_clientModel);
}
if (coinJoinCoinsPage != nullptr) {
coinJoinCoinsPage->setClientModel(_clientModel);
}
QSettings settings;
if (settings.value("fShowMasternodesTab").toBool()) {
if (settings.value("fShowMasternodesTab").toBool() && masternodeListPage != nullptr) {
masternodeListPage->setClientModel(_clientModel);
}
if (settings.value("fShowGovernanceTab").toBool()) {
if (settings.value("fShowGovernanceTab").toBool() && governanceListPage != nullptr) {
governanceListPage->setClientModel(_clientModel);
}
}