From 4471eb587d9091ffeb9e115d51001e53a60d0a19 Mon Sep 17 00:00:00 2001 From: John Preston Date: Tue, 9 Jan 2024 13:11:25 +0400 Subject: [PATCH] Fix possible crash in gift box sticker lookup. --- Telegram/SourceFiles/chat_helpers/stickers_gift_box_pack.cpp | 2 ++ 1 file changed, 2 insertions(+) diff --git a/Telegram/SourceFiles/chat_helpers/stickers_gift_box_pack.cpp b/Telegram/SourceFiles/chat_helpers/stickers_gift_box_pack.cpp index e20c361d66..f54b1f1d35 100644 --- a/Telegram/SourceFiles/chat_helpers/stickers_gift_box_pack.cpp +++ b/Telegram/SourceFiles/chat_helpers/stickers_gift_box_pack.cpp @@ -26,6 +26,8 @@ DocumentData *GiftBoxPack::lookup(int months) const { const auto fallback = _documents.empty() ? nullptr : _documents[0]; if (it == begin(_localMonths)) { return fallback; + } else if (it == end(_localMonths)) { + return _documents.back(); } const auto left = *(it - 1); const auto right = *it;