From 44ff8f92accf02ddcb7a9cde1db1c76a7b694b02 Mon Sep 17 00:00:00 2001 From: John Preston Date: Tue, 25 Dec 2018 15:22:25 +0400 Subject: [PATCH] Fix crash with invalid custom langpacks. --- Telegram/SourceFiles/ui/effects/numbers_animation.cpp | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/Telegram/SourceFiles/ui/effects/numbers_animation.cpp b/Telegram/SourceFiles/ui/effects/numbers_animation.cpp index beca4ebdc..a6e20077e 100644 --- a/Telegram/SourceFiles/ui/effects/numbers_animation.cpp +++ b/Telegram/SourceFiles/ui/effects/numbers_animation.cpp @@ -158,7 +158,7 @@ LabelWithNumbers::LabelWithNumbers( , _textTop(textTop) , _before(GetBefore(value)) , _after(GetAfter(value)) -, _numbers(_st.style.font, [this] { update(); }) +, _numbers(_st.style.font, [=] { update(); }) , _beforeWidth(_st.style.font->width(_before)) , _afterWidth(st.style.font->width(_after)) { Expects((value.offset < 0) == (value.length == 0)); @@ -247,6 +247,9 @@ Ui::StringWithNumbers ReplaceTag::Call( ushort tag, const Ui::StringWithNumbers &replacement) { original.offset = FindTagReplacementPosition(original.text, tag); + if (original.offset < 0) { + return std::move(original); + } original.text = ReplaceTag::Call( std::move(original.text), tag,