summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorJohn Preston <johnprestonmail@gmail.com>2022-04-16 20:58:13 +0400
committerJohn Preston <johnprestonmail@gmail.com>2022-04-16 20:58:17 +0400
commite3dc4ae0889355037c2a950ca1deabf97cd76132 (patch)
tree3517d289e3ccf96b5dcf88463406237dc5395271
parent000d9d8b52680c2900b944d6ef3eab7a4f6fdd94 (diff)
Version 3.7: Fix a crash in some langpacks.v3.7.0
-rw-r--r--Telegram/SourceFiles/boxes/reactions_settings_box.cpp1
-rw-r--r--Telegram/SourceFiles/data/data_peer.cpp6
2 files changed, 5 insertions, 2 deletions
diff --git a/Telegram/SourceFiles/boxes/reactions_settings_box.cpp b/Telegram/SourceFiles/boxes/reactions_settings_box.cpp
index a03d2dbdce..19cbd90641 100644
--- a/Telegram/SourceFiles/boxes/reactions_settings_box.cpp
+++ b/Telegram/SourceFiles/boxes/reactions_settings_box.cpp
@@ -43,6 +43,7 @@ constexpr auto kVisibleButtonsCount = 7;
PeerId GenerateUser(not_null<History*> history, const QString &name) {
Expects(history->peer->isUser());
+
const auto peerId = Data::FakePeerIdForJustName(name);
history->owner().processUser(MTP_user(
MTP_flags(MTPDuser::Flag::f_first_name | MTPDuser::Flag::f_min),
diff --git a/Telegram/SourceFiles/data/data_peer.cpp b/Telegram/SourceFiles/data/data_peer.cpp
index ce9bd3e352..ac7ec65184 100644
--- a/Telegram/SourceFiles/data/data_peer.cpp
+++ b/Telegram/SourceFiles/data/data_peer.cpp
@@ -81,9 +81,11 @@ style::color PeerUserpicColor(PeerId peerId) {
}
PeerId FakePeerIdForJustName(const QString &name) {
- return peerFromUser(name.isEmpty()
+ constexpr auto kShift = (0xFEULL << 32);
+ const auto base = name.isEmpty()
? 777
- : base::crc32(name.constData(), name.size() * sizeof(QChar)));
+ : base::crc32(name.constData(), name.size() * sizeof(QChar));
+ return peerFromUser(kShift + std::abs(base));
}
bool UpdateBotCommands(