From c5802a0f4918bbf1e0e6741315ada8a5ae1131e0 Mon Sep 17 00:00:00 2001 From: pajlada Date: Sat, 25 May 2024 13:53:37 +0200 Subject: [PATCH] fix: use `irc-unknown` when irc server couldn't be loaded (#5419) --- CHANGELOG.md | 1 + src/common/Channel.cpp | 12 ++++++++++-- 2 files changed, 11 insertions(+), 2 deletions(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index 93dcf2ea6..3f12f82a4 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -8,6 +8,7 @@ - Minor: Colored usernames now update on the fly when changing the "Color @usernames" setting. (#5300) - Minor: Added `flags.action` filter variable, allowing you to filter on `/me` messages. (#5397) - Bugfix: If a network request errors with 200 OK, Qt's error code is now reported instead of the HTTP status. (#5378) +- Bugfix: Fixed a crash that could occur when logging was enabled in IRC servers that were removed. (#5419) - Dev: Use Qt's high DPI scaling. (#4868, #5400) - Dev: Add doxygen build target. (#5377) - Dev: Make printing of strings in tests easier. (#5379) diff --git a/src/common/Channel.cpp b/src/common/Channel.cpp index 872ba2462..7141dbe7e 100644 --- a/src/common/Channel.cpp +++ b/src/common/Channel.cpp @@ -92,8 +92,16 @@ void Channel::addMessage(MessagePtr message, auto *irc = dynamic_cast(this); if (irc != nullptr) { - channelPlatform = QString("irc-%1").arg( - irc->server()->userFriendlyIdentifier()); + auto *ircServer = irc->server(); + if (ircServer != nullptr) + { + channelPlatform = QString("irc-%1").arg( + irc->server()->userFriendlyIdentifier()); + } + else + { + channelPlatform = "irc-unknown"; + } } } else if (this->isTwitchChannel())