From e0d48843513044aa56df10d9e044b89b606245ab Mon Sep 17 00:00:00 2001 From: John Preston Date: Tue, 28 May 2019 14:46:18 +0200 Subject: [PATCH] Fix possible crash in animations. --- Telegram/SourceFiles/ui/effects/animations.h | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/Telegram/SourceFiles/ui/effects/animations.h b/Telegram/SourceFiles/ui/effects/animations.h index b49a586d2..7c1cacc7f 100644 --- a/Telegram/SourceFiles/ui/effects/animations.h +++ b/Telegram/SourceFiles/ui/effects/animations.h @@ -234,8 +234,11 @@ TG_FORCE_INLINE bool Basic::animating() const { } TG_FORCE_INLINE bool Basic::call(crl::time now) const { + Expects(_started >= 0); + + // _started may be greater than now if we called restart while iterating. const auto onstack = _callback; - return onstack(now); + return onstack(std::max(_started, now)); } inline Basic::~Basic() {