From ac50119dd9e3872bf6861aabacf965b0a84aad2c Mon Sep 17 00:00:00 2001
From: John Preston <johnprestonmail@gmail.com>
Date: Thu, 21 May 2015 16:46:49 +0300
Subject: [PATCH] version 0.8.17 crash fix

---
 Telegram/PrepareWin.bat                     |   6 +++---
 Telegram/SourceFiles/application.cpp        |   2 ++
 Telegram/SourceFiles/config.h               |   4 ++--
 Telegram/SourceFiles/historywidget.cpp      |   2 +-
 Telegram/Telegram.plist                     |   2 +-
 Telegram/Telegram.rc                        | Bin 5540 -> 5540 bytes
 Telegram/Telegram.xcodeproj/project.pbxproj |  12 ++++++------
 Telegram/Version.sh                         |   2 +-
 8 files changed, 16 insertions(+), 14 deletions(-)

diff --git a/Telegram/PrepareWin.bat b/Telegram/PrepareWin.bat
index bcb0bf972..4082028af 100644
--- a/Telegram/PrepareWin.bat
+++ b/Telegram/PrepareWin.bat
@@ -1,9 +1,9 @@
 @echo OFF
 
 set "AppVersion=8016"
-set "AppVersionStrSmall=0.8.16"
-set "AppVersionStr=0.8.16"
-set "AppVersionStrFull=0.8.16.0"
+set "AppVersionStrSmall=0.8.17"
+set "AppVersionStr=0.8.17"
+set "AppVersionStrFull=0.8.17.0"
 set "DevChannel=0"
 
 if %DevChannel% neq 0 goto preparedev
diff --git a/Telegram/SourceFiles/application.cpp b/Telegram/SourceFiles/application.cpp
index 67c4808c2..73afc1ee0 100644
--- a/Telegram/SourceFiles/application.cpp
+++ b/Telegram/SourceFiles/application.cpp
@@ -666,6 +666,8 @@ void Application::checkMapVersion() {
 				versionFeatures = QString::fromUtf8("\xe2\x80\x94 Video captions are displayed\n\xe2\x80\x94 Photo captions are displayed in photo viewer\n\xe2\x80\x94 Round corners for messages").replace('@', qsl("@") + QChar(0x200D));
 			} else if (!DevChannel && Local::oldMapVersion() < 8016) {
 				versionFeatures = lang(lng_new_version_text).trimmed();
+			} else if (!DevChannel && Local::oldMapVersion() < 8017) {
+				versionFeatures = lang(lng_new_version_minor).trimmed();
 			}
 			if (!versionFeatures.isEmpty()) {
 				versionFeatures = lng_new_version_wrap(lt_version, QString::fromStdWString(AppVersionStr), lt_changes, versionFeatures, lt_link, qsl("https://desktop.telegram.org/#changelog"));
diff --git a/Telegram/SourceFiles/config.h b/Telegram/SourceFiles/config.h
index 4a2aa0637..a49551dc1 100644
--- a/Telegram/SourceFiles/config.h
+++ b/Telegram/SourceFiles/config.h
@@ -17,8 +17,8 @@ Copyright (c) 2014 John Preston, https://desktop.telegram.org
 */
 #pragma once
 
-static const int32 AppVersion = 8016;
-static const wchar_t *AppVersionStr = L"0.8.16";
+static const int32 AppVersion = 8017;
+static const wchar_t *AppVersionStr = L"0.8.17";
 static const bool DevChannel = false;
 
 static const wchar_t *AppNameOld = L"Telegram Win (Unofficial)";
diff --git a/Telegram/SourceFiles/historywidget.cpp b/Telegram/SourceFiles/historywidget.cpp
index fa4dd1788..6faef6e6c 100644
--- a/Telegram/SourceFiles/historywidget.cpp
+++ b/Telegram/SourceFiles/historywidget.cpp
@@ -701,7 +701,7 @@ void HistoryList::showContextMenu(QContextMenuEvent *e, bool showFromTouch) {
 				_menu->addAction(lang(lng_context_reply_msg), historyWidget, SLOT(onReplyToMessage()));
 			}
 			if (item && !isUponSelected && !_contextMenuLnk) {
-				if (HistorySticker *sticker = dynamic_cast<HistorySticker*>(msg->getMedia())) {
+				if (HistorySticker *sticker = dynamic_cast<HistorySticker*>(msg ? msg->getMedia() : 0)) {
 					DocumentData *doc = sticker->document();
 					if (doc && doc->sticker && doc->sticker->set.type() != mtpc_inputStickerSetEmpty) {
 						if (!_menu) _menu = new ContextMenu(this);
diff --git a/Telegram/Telegram.plist b/Telegram/Telegram.plist
index eab1cc13a..05f175be8 100644
--- a/Telegram/Telegram.plist
+++ b/Telegram/Telegram.plist
@@ -11,7 +11,7 @@
 	<key>CFBundlePackageType</key>
 	<string>APPL</string>
 	<key>CFBundleShortVersionString</key>
-	<string>0.8.16</string>
+	<string>0.8.17</string>
 	<key>CFBundleSignature</key>
 	<string>????</string>
 	<key>CFBundleURLTypes</key>
diff --git a/Telegram/Telegram.rc b/Telegram/Telegram.rc
index 3f9a8ef15819d287b09fc7cdd238969e106ff455..a25e749e5b4b32022008f7a1ab04f6c2d663f735 100644
GIT binary patch
delta 53
zcmZ3Yy+nIM5ig_p<YHc9M)S?fc_%WlnltDz7);(Mpu0IsfQJ#z6`#CBP-yWIK^6d;
C&<>6O

delta 53
zcmZ3Yy+nIM5ig_J<YHc9MzhV!c_%Wlnlb1x7);(Mpu0IsfQJ#z6`#CBP-yWIK^6d;
COAd+v

diff --git a/Telegram/Telegram.xcodeproj/project.pbxproj b/Telegram/Telegram.xcodeproj/project.pbxproj
index 825de07c3..173ac5e1d 100644
--- a/Telegram/Telegram.xcodeproj/project.pbxproj
+++ b/Telegram/Telegram.xcodeproj/project.pbxproj
@@ -1697,7 +1697,7 @@
 			buildSettings = {
 				ASSETCATALOG_COMPILER_APPICON_NAME = AppIcon;
 				COPY_PHASE_STRIP = NO;
-				CURRENT_PROJECT_VERSION = 0.8.16;
+				CURRENT_PROJECT_VERSION = 0.8.17;
 				DEBUG_INFORMATION_FORMAT = dwarf;
 				GCC_GENERATE_DEBUGGING_SYMBOLS = YES;
 				GCC_OPTIMIZATION_LEVEL = 0;
@@ -1715,7 +1715,7 @@
 			buildSettings = {
 				ASSETCATALOG_COMPILER_APPICON_NAME = AppIcon;
 				COPY_PHASE_STRIP = YES;
-				CURRENT_PROJECT_VERSION = 0.8.16;
+				CURRENT_PROJECT_VERSION = 0.8.17;
 				GCC_GENERATE_DEBUGGING_SYMBOLS = NO;
 				GCC_OPTIMIZATION_LEVEL = fast;
 				GCC_PREFIX_HEADER = ./SourceFiles/stdafx.h;
@@ -1741,10 +1741,10 @@
 				CLANG_WARN__DUPLICATE_METHOD_MATCH = YES;
 				CODE_SIGN_IDENTITY = "";
 				COPY_PHASE_STRIP = NO;
-				CURRENT_PROJECT_VERSION = 0.8.16;
+				CURRENT_PROJECT_VERSION = 0.8.17;
 				DEBUG_INFORMATION_FORMAT = "dwarf-with-dsym";
 				DYLIB_COMPATIBILITY_VERSION = 0.8;
-				DYLIB_CURRENT_VERSION = 0.8.16;
+				DYLIB_CURRENT_VERSION = 0.8.17;
 				ENABLE_STRICT_OBJC_MSGSEND = YES;
 				FRAMEWORK_SEARCH_PATHS = "";
 				GCC_GENERATE_DEBUGGING_SYMBOLS = YES;
@@ -1883,10 +1883,10 @@
 				CLANG_WARN__DUPLICATE_METHOD_MATCH = YES;
 				CODE_SIGN_IDENTITY = "";
 				COPY_PHASE_STRIP = NO;
-				CURRENT_PROJECT_VERSION = 0.8.16;
+				CURRENT_PROJECT_VERSION = 0.8.17;
 				DEBUG_INFORMATION_FORMAT = dwarf;
 				DYLIB_COMPATIBILITY_VERSION = 0.8;
-				DYLIB_CURRENT_VERSION = 0.8.16;
+				DYLIB_CURRENT_VERSION = 0.8.17;
 				ENABLE_STRICT_OBJC_MSGSEND = YES;
 				FRAMEWORK_SEARCH_PATHS = "";
 				GCC_GENERATE_DEBUGGING_SYMBOLS = YES;
diff --git a/Telegram/Version.sh b/Telegram/Version.sh
index 2f2cacc46..e0ab93ebb 100755
--- a/Telegram/Version.sh
+++ b/Telegram/Version.sh
@@ -1,2 +1,2 @@
-echo 8016 0.8.16 0
+echo 8017 0.8.17 0
 # AppVersion AppVersionStr DevChannel