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

View file

@ -26,6 +26,8 @@ DocumentData *GiftBoxPack::lookup(int months) const {
const auto fallback = _documents.empty() ? nullptr : _documents[0]; const auto fallback = _documents.empty() ? nullptr : _documents[0];
if (it == begin(_localMonths)) { if (it == begin(_localMonths)) {
return fallback; return fallback;
} else if (it == end(_localMonths)) {
return _documents.back();
} }
const auto left = *(it - 1); const auto left = *(it - 1);
const auto right = *it; const auto right = *it;