client: Fix settings crash on missing net identity
authorShane Synan <digitalcircuit36939@gmail.com>
Wed, 23 Sep 2020 04:17:47 +0000 (00:17 -0400)
committerManuel Nickschas <sputnick@quassel-irc.org>
Sat, 28 Nov 2020 12:55:38 +0000 (13:55 +0100)
commitc144bdee0d8ab0c195b3088f5c6e57e372e526f7
treedd83629371b04fb29e2ddcf367dbc36036b08e59
parent518cd2bc478ab3675a60ec46d3ef183cace0cae7
client: Fix settings crash on missing net identity

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
src/qtui/settingspages/networkssettingspage.cpp