From 6fae60b6bb6325baab90e0b5755d9fa0b5704d20 Mon Sep 17 00:00:00 2001
From: John Preston <johnprestonmail@gmail.com>
Date: Fri, 26 Feb 2016 16:00:48 +0300
Subject: [PATCH] fixed conversations list update on message edit

---
 Telegram/SourceFiles/app.cpp         | 6 ++++++
 Telegram/SourceFiles/mtproto/mtp.cpp | 5 ++++-
 2 files changed, 10 insertions(+), 1 deletion(-)

diff --git a/Telegram/SourceFiles/app.cpp b/Telegram/SourceFiles/app.cpp
index a96c182e7..521f923ad 100644
--- a/Telegram/SourceFiles/app.cpp
+++ b/Telegram/SourceFiles/app.cpp
@@ -931,6 +931,12 @@ namespace App {
 			existing->updateMedia(m.has_media() ? (&m.vmedia) : 0, true);
 			existing->setViewsCount(m.has_views() ? m.vviews.v : -1, false);
 			existing->initDimensions();
+			if (existing->history()->textCachedFor == existing) {
+				existing->history()->textCachedFor = 0;
+			}
+			if (App::main()) {
+				App::main()->dlgUpdated(existing->history(), existing->id);
+			}
 			Notify::historyItemResized(existing);
 		}
 	}
diff --git a/Telegram/SourceFiles/mtproto/mtp.cpp b/Telegram/SourceFiles/mtproto/mtp.cpp
index 6f443783c..7b834ce51 100644
--- a/Telegram/SourceFiles/mtproto/mtp.cpp
+++ b/Telegram/SourceFiles/mtproto/mtp.cpp
@@ -531,7 +531,10 @@ namespace _mtp_internal {
 						return;
 					}
 				} else {
-					if (h.onDone) (*h.onDone)(requestId, from, end);
+					if (h.onDone) {
+//						t_assert(App::app() != 0);
+						(*h.onDone)(requestId, from, end);
+					}
 				}
 			} catch (Exception &e) {
 				if (!rpcErrorOccured(requestId, h, rpcClientError("RESPONSE_PARSE_FAILED", QString("exception text: ") + e.what()))) {