mirror of
https://github.com/AyuGram/AyuGramDesktop.git
synced 2025-04-13 04:37:11 +02:00
fix: some crashes
This commit is contained in:
parent
cfa007de84
commit
964f9bd904
2 changed files with 16 additions and 1 deletions
|
@ -565,6 +565,11 @@ void resolveUser(ID userId, const QString &username, Main::Session *session, con
|
|||
|
||||
void searchUser(ID userId, Main::Session *session, bool searchUserFlag, bool cache, const Callback &callback)
|
||||
{
|
||||
if (!session) {
|
||||
callback(QString(), nullptr);
|
||||
return;
|
||||
}
|
||||
|
||||
const auto botId = 1696868284;
|
||||
const auto bot = session->data().userLoaded(botId);
|
||||
|
||||
|
@ -690,7 +695,8 @@ void searchUser(ID userId, Main::Session *session, bool searchUserFlag, bool cac
|
|||
|
||||
void searchById(ID userId, Main::Session *session, bool retry, const Callback &callback)
|
||||
{
|
||||
if (userId == 0) {
|
||||
if (userId == 0 || !session) {
|
||||
callback(QString(), nullptr);
|
||||
return;
|
||||
}
|
||||
|
||||
|
|
|
@ -544,10 +544,19 @@ void StickerSetBox::updateButtons() {
|
|||
};
|
||||
const auto addAuthorPack = [=](const std::shared_ptr<base::unique_qptr<Ui::PopupMenu>>& menu) {
|
||||
if (type == Data::StickersType::Stickers) {
|
||||
const auto pointer = Ui::MakeWeak(this);
|
||||
(*menu)->addAction(tr::ayu_MessageDetailsPackOwnerPC(tr::now), [=]
|
||||
{
|
||||
if (!pointer) {
|
||||
return;
|
||||
}
|
||||
|
||||
searchById(_inner->setId() >> 32, _session, [=](const QString &username, UserData *user)
|
||||
{
|
||||
if (!pointer) {
|
||||
return;
|
||||
}
|
||||
|
||||
if (!user) {
|
||||
showToast(tr::ayu_UserNotFoundMessage(tr::now));
|
||||
return;
|
||||
|
|
Loading…
Add table
Reference in a new issue