mirror of
https://github.com/AyuGram/AyuGramDesktop.git
synced 2025-06-05 06:33:57 +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()) {
|
if (!state->requests.empty()) {
|
||||||
return; // Share clicked already.
|
return; // Share clicked already.
|
||||||
}
|
}
|
||||||
auto items = history->owner().idsToItems(msgIds);
|
const auto items = history->owner().idsToItems(msgIds);
|
||||||
if (items.empty() || result.empty()) {
|
const auto existingIds = history->owner().itemsToIds(items);
|
||||||
|
if (existingIds.empty() || result.empty()) {
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -1384,12 +1385,12 @@ ShareBox::SubmitCallback ShareBox::DefaultForwardCallback(
|
||||||
? Flag::f_drop_media_captions
|
? Flag::f_drop_media_captions
|
||||||
: Flag(0));
|
: Flag(0));
|
||||||
auto mtpMsgIds = QVector<MTPint>();
|
auto mtpMsgIds = QVector<MTPint>();
|
||||||
mtpMsgIds.reserve(msgIds.size());
|
mtpMsgIds.reserve(existingIds.size());
|
||||||
for (const auto &fullId : msgIds) {
|
for (const auto &fullId : existingIds) {
|
||||||
mtpMsgIds.push_back(MTP_int(fullId.msg));
|
mtpMsgIds.push_back(MTP_int(fullId.msg));
|
||||||
}
|
}
|
||||||
const auto generateRandom = [&] {
|
const auto generateRandom = [&] {
|
||||||
auto result = QVector<MTPlong>(msgIds.size());
|
auto result = QVector<MTPlong>(existingIds.size());
|
||||||
for (auto &value : result) {
|
for (auto &value : result) {
|
||||||
value = base::RandomValue<MTPlong>();
|
value = base::RandomValue<MTPlong>();
|
||||||
}
|
}
|
||||||
|
|
|
@ -1656,7 +1656,11 @@ QPointer<Ui::BoxContent> ShowForwardMessagesBox(
|
||||||
not_null<Window::SessionNavigation*> navigation,
|
not_null<Window::SessionNavigation*> navigation,
|
||||||
Data::ForwardDraft &&draft,
|
Data::ForwardDraft &&draft,
|
||||||
Fn<void()> &&successCallback) {
|
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 {
|
class ListBox final : public PeerListBox {
|
||||||
public:
|
public:
|
||||||
|
|
Loading…
Add table
Reference in a new issue