Always try to fetch mask_position.

This commit is contained in:
levlam 2022-07-21 15:54:43 +03:00
parent 52214f37bc
commit 310c4d1b6a

View File

@ -6201,27 +6201,25 @@ tl_object_ptr<telegram_api::inputStickerSetItem> StickersManager::get_input_stic
auto input_document = file_view.main_remote_location().as_input_document(); auto input_document = file_view.main_remote_location().as_input_document();
tl_object_ptr<telegram_api::maskCoords> mask_coords; tl_object_ptr<telegram_api::maskCoords> mask_coords;
if (::td::get_sticker_type(sticker->type_) == StickerType::Mask) { auto mask_position = sticker->mask_position_.get();
auto mask_position = sticker->mask_position_.get(); if (mask_position != nullptr && mask_position->point_ != nullptr) {
if (mask_position != nullptr && mask_position->point_ != nullptr) { auto point = [mask_point_id = mask_position->point_->get_id()] {
auto point = [mask_point_id = mask_position->point_->get_id()] { switch (mask_point_id) {
switch (mask_point_id) { case td_api::maskPointForehead::ID:
case td_api::maskPointForehead::ID: return 0;
return 0; case td_api::maskPointEyes::ID:
case td_api::maskPointEyes::ID: return 1;
return 1; case td_api::maskPointMouth::ID:
case td_api::maskPointMouth::ID: return 2;
return 2; case td_api::maskPointChin::ID:
case td_api::maskPointChin::ID: return 3;
return 3; default:
default: UNREACHABLE();
UNREACHABLE(); return -1;
return -1; }
} }();
}(); mask_coords = make_tl_object<telegram_api::maskCoords>(point, mask_position->x_shift_, mask_position->y_shift_,
mask_coords = make_tl_object<telegram_api::maskCoords>(point, mask_position->x_shift_, mask_position->y_shift_, mask_position->scale_);
mask_position->scale_);
}
} }
int32 flags = 0; int32 flags = 0;