Fix crash in notifyTwitchChannelOffline when snapshot is empty (#6604)

Reviewed-by: Rasmus Karlsson <rasmus.karlsson@pajlada.com>
This commit is contained in:
etenie
2025-11-27 16:42:17 +01:00
committed by GitHub
parent c4dd5f43ce
commit a935965390
2 changed files with 8 additions and 1 deletions
@@ -156,6 +156,13 @@ void NotificationController::notifyTwitchChannelOffline(const QString &id) const
// "delete" old 'CHANNEL is live' message
const LimitedQueueSnapshot<MessagePtr> snapshot =
getApp()->getTwitch()->getLiveChannel()->getMessageSnapshot(200);
// Guard against empty snapshot to prevent underflow and invalid access
if (snapshot.size() == 0)
{
return;
}
for (size_t i = snapshot.size() - 1; i >= 0; --i)
{
const auto &s = snapshot[i];