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
+1 -1
View File
@@ -51,7 +51,7 @@
- Dev: Mock headers are now added as a header set if supported by CMake. (#6561)
- Dev: Set settings directory to temporary one used in tests. (#6584)
- Dev: Check Lua unwinding and version in tests. (#6586)
- Dev: Added method to get the last N messages of a channel. (#6602)
- Dev: Added method to get the last N messages of a channel. (#6602, #6604)
## 2.5.4
@@ -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];