mirror of
https://github.com/AyuGram/AyuGramDesktop.git
synced 2025-06-08 08:04:08 +02:00
Fix crash in bot callback sending.
This commit is contained in:
parent
9463bbd266
commit
04f95e905e
1 changed files with 12 additions and 3 deletions
|
@ -35,10 +35,11 @@ void SendBotCallbackData(
|
||||||
const auto owner = &history->owner();
|
const auto owner = &history->owner();
|
||||||
const auto api = &session->api();
|
const auto api = &session->api();
|
||||||
const auto bot = item->getMessageBot();
|
const auto bot = item->getMessageBot();
|
||||||
|
const auto fullId = item->fullId();
|
||||||
const auto getButton = [=] {
|
const auto getButton = [=] {
|
||||||
return HistoryMessageMarkupButton::Get(
|
return HistoryMessageMarkupButton::Get(
|
||||||
owner,
|
owner,
|
||||||
item->fullId(),
|
fullId,
|
||||||
row,
|
row,
|
||||||
column);
|
column);
|
||||||
};
|
};
|
||||||
|
@ -63,7 +64,11 @@ void SendBotCallbackData(
|
||||||
history->peer->input,
|
history->peer->input,
|
||||||
MTP_int(item->id),
|
MTP_int(item->id),
|
||||||
MTP_bytes(sendData)
|
MTP_bytes(sendData)
|
||||||
)).done([=](const MTPmessages_BotCallbackAnswer &result, auto id) {
|
)).done([=](const MTPmessages_BotCallbackAnswer &result) {
|
||||||
|
const auto item = owner->message(fullId);
|
||||||
|
if (!item) {
|
||||||
|
return;
|
||||||
|
}
|
||||||
if (const auto button = getButton()) {
|
if (const auto button = getButton()) {
|
||||||
button->requestId = 0;
|
button->requestId = 0;
|
||||||
owner->requestItemRepaint(item);
|
owner->requestItemRepaint(item);
|
||||||
|
@ -91,7 +96,11 @@ void SendBotCallbackData(
|
||||||
Api::SendProgressType::PlayGame);
|
Api::SendProgressType::PlayGame);
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
}).fail([=](const RPCError &error, auto id) {
|
}).fail([=](const RPCError &error) {
|
||||||
|
const auto item = owner->message(fullId);
|
||||||
|
if (!item) {
|
||||||
|
return;
|
||||||
|
}
|
||||||
// Show error?
|
// Show error?
|
||||||
if (const auto button = getButton()) {
|
if (const auto button = getButton()) {
|
||||||
button->requestId = 0;
|
button->requestId = 0;
|
||||||
|
|
Loading…
Add table
Reference in a new issue