Fix crash in notifyTwitchChannelOffline when snapshot is empty (#6604)
Reviewed-by: Rasmus Karlsson <rasmus.karlsson@pajlada.com>
This commit is contained in:
+1
-1
@@ -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];
|
||||
|
||||
Reference in New Issue
Block a user