mirror of
https://github.com/telegramdesktop/tdesktop
synced 2024-12-25 16:02:52 +00:00
Fix crash with invalid custom langpacks.
This commit is contained in:
parent
95208267de
commit
44ff8f92ac
@ -158,7 +158,7 @@ LabelWithNumbers::LabelWithNumbers(
|
|||||||
, _textTop(textTop)
|
, _textTop(textTop)
|
||||||
, _before(GetBefore(value))
|
, _before(GetBefore(value))
|
||||||
, _after(GetAfter(value))
|
, _after(GetAfter(value))
|
||||||
, _numbers(_st.style.font, [this] { update(); })
|
, _numbers(_st.style.font, [=] { update(); })
|
||||||
, _beforeWidth(_st.style.font->width(_before))
|
, _beforeWidth(_st.style.font->width(_before))
|
||||||
, _afterWidth(st.style.font->width(_after)) {
|
, _afterWidth(st.style.font->width(_after)) {
|
||||||
Expects((value.offset < 0) == (value.length == 0));
|
Expects((value.offset < 0) == (value.length == 0));
|
||||||
@ -247,6 +247,9 @@ Ui::StringWithNumbers ReplaceTag<Ui::StringWithNumbers>::Call(
|
|||||||
ushort tag,
|
ushort tag,
|
||||||
const Ui::StringWithNumbers &replacement) {
|
const Ui::StringWithNumbers &replacement) {
|
||||||
original.offset = FindTagReplacementPosition(original.text, tag);
|
original.offset = FindTagReplacementPosition(original.text, tag);
|
||||||
|
if (original.offset < 0) {
|
||||||
|
return std::move(original);
|
||||||
|
}
|
||||||
original.text = ReplaceTag<QString>::Call(
|
original.text = ReplaceTag<QString>::Call(
|
||||||
std::move(original.text),
|
std::move(original.text),
|
||||||
tag,
|
tag,
|
||||||
|
Loading…
Reference in New Issue
Block a user