When fetching the client identity in Network settings, make sure the
identity exists before trying to convert it into a CertIdentity.
This resolves a crash if an identity is deleted improperly or if no
identities are specified.
Test case:
1. Clear the configuration for Quassel monolithic
2. Start Quassel monolithic
3. Cancel the setup wizard (before creating any identity)
4. Go to Settings -> Configure Quassel... (F7)
5. Navigate to IRC -> Identities, confirm that no identity exists
6. Navigate to IRC -> Networks
7. Add a new network (details don't matter)
8. Observe results
NOTE: This fix was contributed by "kater" on the Quassel IRC bug
tracker. I'm not sure of a better way to provide attribution, as I
don't know if they want their email address part of Quassel's public
record.
See the original patch here:
https://bugs.quassel-irc.org/issues/1409
Fixes #1409
// this is only needed when the core supports SASL EXTERNAL
if (Client::isCoreFeatureEnabled(Quassel::Feature::SaslExternal)) {
if (_cid) {
// this is only needed when the core supports SASL EXTERNAL
if (Client::isCoreFeatureEnabled(Quassel::Feature::SaslExternal)) {
if (_cid) {
+ // Clean up existing CertIdentity
disconnect(_cid, &CertIdentity::sslSettingsUpdated, this, &NetworksSettingsPage::sslUpdated);
delete _cid;
disconnect(_cid, &CertIdentity::sslSettingsUpdated, this, &NetworksSettingsPage::sslUpdated);
delete _cid;
+ _cid = nullptr;
+ }
+ auto *identity = Client::identity(info.identity);
+ if (identity) {
+ // Connect new CertIdentity
+ _cid = new CertIdentity(*identity, this);
+ _cid->enableEditSsl(true);
+ connect(_cid, &CertIdentity::sslSettingsUpdated, this, &NetworksSettingsPage::sslUpdated);
+ }
+ else {
+ qWarning() << "NetworksSettingsPage::displayNetwork can't find Identity for IdentityId:" << info.identity;
- _cid = new CertIdentity(*Client::identity(info.identity), this);
- _cid->enableEditSsl(true);
- connect(_cid, &CertIdentity::sslSettingsUpdated, this, &NetworksSettingsPage::sslUpdated);
}
ui.identityList->setCurrentIndex(ui.identityList->findData(info.identity.toInt()));
}
ui.identityList->setCurrentIndex(ui.identityList->findData(info.identity.toInt()));