mirror of
https://github.com/AyuGram/AyuGramDesktop.git
synced 2025-06-07 23:53:58 +02:00
Fix possible crash in top bar widget init.
This commit is contained in:
parent
370ad0aa44
commit
a6c76382e3
1 changed files with 9 additions and 6 deletions
|
@ -536,6 +536,9 @@ void TopBarWidget::updateSearchVisibility() {
|
||||||
}
|
}
|
||||||
|
|
||||||
void TopBarWidget::updateControlsGeometry() {
|
void TopBarWidget::updateControlsGeometry() {
|
||||||
|
if (!_activeChat) {
|
||||||
|
return;
|
||||||
|
}
|
||||||
auto hasSelected = (_selectedCount > 0);
|
auto hasSelected = (_selectedCount > 0);
|
||||||
auto selectedButtonsTop = countSelectedButtonsTop(_selectedShown.value(hasSelected ? 1. : 0.));
|
auto selectedButtonsTop = countSelectedButtonsTop(_selectedShown.value(hasSelected ? 1. : 0.));
|
||||||
auto otherButtonsTop = selectedButtonsTop + st::topBarHeight;
|
auto otherButtonsTop = selectedButtonsTop + st::topBarHeight;
|
||||||
|
@ -615,7 +618,9 @@ void TopBarWidget::setAnimatingMode(bool enabled) {
|
||||||
}
|
}
|
||||||
|
|
||||||
void TopBarWidget::updateControlsVisibility() {
|
void TopBarWidget::updateControlsVisibility() {
|
||||||
if (_animatingMode) {
|
if (!_activeChat) {
|
||||||
|
return;
|
||||||
|
} else if (_animatingMode) {
|
||||||
hideChildren();
|
hideChildren();
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
@ -660,14 +665,12 @@ void TopBarWidget::updateControlsVisibility() {
|
||||||
|
|
||||||
void TopBarWidget::updateMembersShowArea() {
|
void TopBarWidget::updateMembersShowArea() {
|
||||||
const auto membersShowAreaNeeded = [&] {
|
const auto membersShowAreaNeeded = [&] {
|
||||||
auto peer = _controller->content()->peer();
|
const auto peer = _activeChat.peer();
|
||||||
if ((_selectedCount > 0) || !peer) {
|
if ((_selectedCount > 0) || !peer) {
|
||||||
return false;
|
return false;
|
||||||
}
|
} else if (const auto chat = peer->asChat()) {
|
||||||
if (auto chat = peer->asChat()) {
|
|
||||||
return chat->amIn();
|
return chat->amIn();
|
||||||
}
|
} else if (const auto megagroup = peer->asMegagroup()) {
|
||||||
if (auto megagroup = peer->asMegagroup()) {
|
|
||||||
return megagroup->canViewMembers()
|
return megagroup->canViewMembers()
|
||||||
&& (megagroup->membersCount()
|
&& (megagroup->membersCount()
|
||||||
< megagroup->session().serverConfig().chatSizeMax);
|
< megagroup->session().serverConfig().chatSizeMax);
|
||||||
|
|
Loading…
Add table
Reference in a new issue