mirror of
https://github.com/AyuGram/AyuGramDesktop.git
synced 2025-04-18 15:17:07 +02:00
fix: a couple of crashes
fix: disable peer ids again
This commit is contained in:
parent
77d129a738
commit
b8dda54e04
4 changed files with 13 additions and 5 deletions
Telegram/SourceFiles
data
info/profile
window
|
@ -775,7 +775,9 @@ FilterId ChatFilters::defaultId() const {
|
|||
}
|
||||
|
||||
FilterId ChatFilters::lookupId(int index) const {
|
||||
Expects(index >= 0 && index < _list.size());
|
||||
if (index >= 0 && index < _list.size()) {
|
||||
return FilterId(); // AyuGram: fix crash when using `hideAllChatsFolder`
|
||||
}
|
||||
|
||||
if (_owner->session().user()->isPremium() || !_list.front().id()) {
|
||||
return _list[index].id();
|
||||
|
|
|
@ -4258,7 +4258,9 @@ void Session::registerItemView(not_null<ViewElement*> view) {
|
|||
}
|
||||
|
||||
void Session::unregisterItemView(not_null<ViewElement*> view) {
|
||||
Expects(!_heavyViewParts.contains(view));
|
||||
if (!_heavyViewParts.contains(view)) {
|
||||
return; // AyuGram: fix crash when using `saveDeletedMessages`
|
||||
}
|
||||
|
||||
_shownSpoilers.remove(view);
|
||||
|
||||
|
|
|
@ -81,6 +81,7 @@ base::options::toggle ShowPeerIdBelowAbout({
|
|||
.id = kOptionShowPeerIdBelowAbout,
|
||||
.name = "Show Peer IDs in Profile",
|
||||
.description = "Show peer IDs from API below their Bio / Description.",
|
||||
.scope = static_cast<base::options::details::ScopeFlag>(0),
|
||||
});
|
||||
|
||||
[[nodiscard]] rpl::producer<TextWithEntities> UsernamesSubtext(
|
||||
|
|
|
@ -256,9 +256,12 @@ void FiltersMenu::refresh() {
|
|||
_scroll.scrollToY(oldTop);
|
||||
|
||||
// Fix active chat folder when hide all chats is enabled.
|
||||
if (settings->hideAllChatsFolder) {
|
||||
const auto lookup_id = filters->lookupId(premium() ? 0 : 1);
|
||||
_session->setActiveChatsFilter(lookup_id);
|
||||
// Also check for session content existance, because it may be null
|
||||
// and there will be an exception in `Window::SessionController::showPeerHistory`
|
||||
// because `SessionController::content()` == nullptr
|
||||
if (settings->hideAllChatsFolder && _session->widget()->sessionContent()) {
|
||||
const auto lookupId = filters->lookupId(premium() ? 0 : 1);
|
||||
_session->setActiveChatsFilter(lookupId);
|
||||
}
|
||||
}
|
||||
|
||||
|
|
Loading…
Add table
Reference in a new issue