Fix possible crash in gift box sticker lookup.

This commit is contained in:
John Preston 2024-01-09 13:11:25 +04:00
parent 3c6037a798
commit 4471eb587d
1 changed files with 2 additions and 0 deletions

View File

@ -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;