diff --git a/src/providers/twitch/twitchserver.cpp b/src/providers/twitch/twitchserver.cpp index 321e43443..ac3b02575 100644 --- a/src/providers/twitch/twitchserver.cpp +++ b/src/providers/twitch/twitchserver.cpp @@ -194,25 +194,21 @@ void TwitchServer::forEachChannelAndSpecialChannels(std::function TwitchServer::getChannelOrEmptyByID(const QString &channelID) { - this->forEachChannel(); + std::lock_guard lock(this->channelMutex); - { - std::lock_guard lock(this->channelMutex); + for (const auto &weakChannel : this->channels) { + auto channel = weakChannel.lock(); + if (!channel) { + continue; + } - for (const auto &weakChannel : this->channels) { - auto channel = weakChannel.lock(); - if (!channel) { - continue; - } + auto twitchChannel = std::dynamic_pointer_cast(channel); + if (!twitchChannel) { + continue; + } - auto twitchChannel = std::dynamic_pointer_cast(channel); - if (!twitchChannel) { - continue; - } - - if (twitchChannel->roomID == channelID) { - return twitchChannel; - } + if (twitchChannel->roomID == channelID) { + return twitchChannel; } }