From 4fc2c18f58da29c8b6a43968122be590a12896b5 Mon Sep 17 00:00:00 2001 From: John Preston Date: Sat, 15 Apr 2017 20:37:43 +0300 Subject: [PATCH] Fix crash in intro label crossfade animation. Remove the assertion because the assumption was not valid. Closed #3270 --- Telegram/SourceFiles/ui/widgets/labels.cpp | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/Telegram/SourceFiles/ui/widgets/labels.cpp b/Telegram/SourceFiles/ui/widgets/labels.cpp index 3cc727395..44d0f6ff8 100644 --- a/Telegram/SourceFiles/ui/widgets/labels.cpp +++ b/Telegram/SourceFiles/ui/widgets/labels.cpp @@ -61,7 +61,12 @@ void CrossFadeAnimation::paintFrame(Painter &p, float64 positionReady, float64 a void CrossFadeAnimation::paintLine(Painter &p, const Line &line, float64 positionReady, float64 alphaWas, float64 alphaNow) { auto &snapshotWas = line.was.snapshot; auto &snapshotNow = line.now.snapshot; - t_assert(!snapshotWas.isNull() || !snapshotNow.isNull()); + if (snapshotWas.isNull() && snapshotNow.isNull()) { + // This can happen if both labels have an empty line or if one + // label has an empty line where the second one already ended. + // In this case lineWidth is zero and snapshot is null. + return; + } auto positionWas = line.was.position; auto positionNow = line.now.position;