Fixed possible crash for bot owners in earn section for bots.

This commit is contained in:
23rd 2024-11-13 10:34:31 +03:00
parent 074bb1e66e
commit 49223a4688

View file

@ -833,7 +833,7 @@ void InnerWidget::fill() {
Ui::AddSkip(container); Ui::AddSkip(container);
} }
#ifndef _DEBUG #ifndef _DEBUG
if (!channel->amCreator()) { if (channel && !channel->amCreator()) {
Ui::AddSkip(container); Ui::AddSkip(container);
Ui::AddSkip(container); Ui::AddSkip(container);
return; return;
@ -1346,8 +1346,8 @@ void InnerWidget::fill() {
handleSlice(firstSlice); handleSlice(firstSlice);
if (!firstSlice.allLoaded) { if (!firstSlice.allLoaded) {
struct ShowMoreState final { struct ShowMoreState final {
ShowMoreState(not_null<ChannelData*> channel) ShowMoreState(not_null<PeerData*> peer)
: api(channel) { : api(peer) {
} }
Api::EarnStatistics api; Api::EarnStatistics api;
bool loading = false; bool loading = false;
@ -1355,7 +1355,7 @@ void InnerWidget::fill() {
rpl::variable<int> showed = 0; rpl::variable<int> showed = 0;
}; };
const auto state const auto state
= lifetime().make_state<ShowMoreState>(channel); = lifetime().make_state<ShowMoreState>(_peer);
state->token = firstSlice.token; state->token = firstSlice.token;
state->showed = firstSlice.list.size(); state->showed = firstSlice.list.size();
const auto max = firstSlice.total; const auto max = firstSlice.total;