mirror of
https://github.com/AyuGram/AyuGramDesktop.git
synced 2025-04-16 06:07:06 +02:00
Fix possible crash in messages forwarding.
Regression was introduced in 2c1e7bfcb6
.
This commit is contained in:
parent
2635b35b74
commit
f66e6879c2
2 changed files with 11 additions and 6 deletions
|
@ -1343,8 +1343,9 @@ ShareBox::SubmitCallback ShareBox::DefaultForwardCallback(
|
|||
if (!state->requests.empty()) {
|
||||
return; // Share clicked already.
|
||||
}
|
||||
auto items = history->owner().idsToItems(msgIds);
|
||||
if (items.empty() || result.empty()) {
|
||||
const auto items = history->owner().idsToItems(msgIds);
|
||||
const auto existingIds = history->owner().itemsToIds(items);
|
||||
if (existingIds.empty() || result.empty()) {
|
||||
return;
|
||||
}
|
||||
|
||||
|
@ -1384,12 +1385,12 @@ ShareBox::SubmitCallback ShareBox::DefaultForwardCallback(
|
|||
? Flag::f_drop_media_captions
|
||||
: Flag(0));
|
||||
auto mtpMsgIds = QVector<MTPint>();
|
||||
mtpMsgIds.reserve(msgIds.size());
|
||||
for (const auto &fullId : msgIds) {
|
||||
mtpMsgIds.reserve(existingIds.size());
|
||||
for (const auto &fullId : existingIds) {
|
||||
mtpMsgIds.push_back(MTP_int(fullId.msg));
|
||||
}
|
||||
const auto generateRandom = [&] {
|
||||
auto result = QVector<MTPlong>(msgIds.size());
|
||||
auto result = QVector<MTPlong>(existingIds.size());
|
||||
for (auto &value : result) {
|
||||
value = base::RandomValue<MTPlong>();
|
||||
}
|
||||
|
|
|
@ -1656,7 +1656,11 @@ QPointer<Ui::BoxContent> ShowForwardMessagesBox(
|
|||
not_null<Window::SessionNavigation*> navigation,
|
||||
Data::ForwardDraft &&draft,
|
||||
Fn<void()> &&successCallback) {
|
||||
const auto msgIds = draft.ids;
|
||||
const auto owner = &navigation->session().data();
|
||||
const auto msgIds = owner->itemsToIds(owner->idsToItems(draft.ids));
|
||||
if (msgIds.empty()) {
|
||||
return nullptr;
|
||||
}
|
||||
|
||||
class ListBox final : public PeerListBox {
|
||||
public:
|
||||
|
|
Loading…
Add table
Reference in a new issue