From 80bb6b65a750d75659f58fcbda5ba99838379ce0 Mon Sep 17 00:00:00 2001
From: John Preston <johnprestonmail@gmail.com>
Date: Fri, 8 Dec 2017 15:53:28 +0400
Subject: [PATCH] Fix possible crash.

---
 Telegram/SourceFiles/mainwindow.cpp | 1 +
 1 file changed, 1 insertion(+)

diff --git a/Telegram/SourceFiles/mainwindow.cpp b/Telegram/SourceFiles/mainwindow.cpp
index 906ee61d1..c05c17461 100644
--- a/Telegram/SourceFiles/mainwindow.cpp
+++ b/Telegram/SourceFiles/mainwindow.cpp
@@ -463,6 +463,7 @@ void MainWindow::ui_showBox(
 		if (_layerBg) {
 			_layerBg->hideTopLayer(animated);
 			if ((animated == anim::type::instant)
+				&& _layerBg
 				&& !_layerBg->layerShown()) {
 				destroyLayerDelayed();
 			}