diff --git a/Telegram/SourceFiles/apiwrap.cpp b/Telegram/SourceFiles/apiwrap.cpp
index 7491cbca3..e8f73066f 100644
--- a/Telegram/SourceFiles/apiwrap.cpp
+++ b/Telegram/SourceFiles/apiwrap.cpp
@@ -1144,7 +1144,7 @@ void ApiWrap::handlePrivacyChange(mtpTypeId keyTypeId, const MTPVector<MTPPrivac
 		_contactsStatusesRequestId = request(MTPcontacts_GetStatuses()).done([this](const MTPVector<MTPContactStatus> &result) {
 			_contactsStatusesRequestId = 0;
 			for_const (auto &item, result.v) {
-				t_assert(item.type() == mtpc_contactStatus);
+				Assert(item.type() == mtpc_contactStatus);
 				auto &data = item.c_contactStatus();
 				if (auto user = App::userLoaded(data.vuser_id.v)) {
 					auto oldOnlineTill = user->onlineTill;
@@ -1889,7 +1889,7 @@ void ApiWrap::sendSaveChatAdminsRequests(not_null<ChatData*> chat) {
 	auto removeOne = [&](auto user) { editOne(user, false); };
 
 	auto admins = _chatAdminsToSave.take(chat);
-	t_assert(!!admins);
+	Assert(!!admins);
 
 	auto toRemove = chat->admins;
 	auto toAppoint = std::vector<not_null<UserData*>>();
diff --git a/Telegram/SourceFiles/app.cpp b/Telegram/SourceFiles/app.cpp
index ca1b6518b..1561f55f5 100644
--- a/Telegram/SourceFiles/app.cpp
+++ b/Telegram/SourceFiles/app.cpp
@@ -1452,7 +1452,7 @@ namespace {
 			} else if (peerIsChannel(id)) {
 				newData = new ChannelData(id);
 			}
-			t_assert(newData != nullptr);
+			Assert(newData != nullptr);
 
 			newData->input = MTPinputPeer(MTP_inputPeerEmpty());
 			i = peersData.insert(id, newData);
diff --git a/Telegram/SourceFiles/app.h b/Telegram/SourceFiles/app.h
index c6bd33edd..fe267ed0c 100644
--- a/Telegram/SourceFiles/app.h
+++ b/Telegram/SourceFiles/app.h
@@ -161,7 +161,7 @@ namespace App {
 	History *historyLoaded(const PeerId &peer);
 	HistoryItem *histItemById(ChannelId channelId, MsgId itemId);
 	inline History *history(const PeerData *peer) {
-		t_assert(peer != nullptr);
+		Assert(peer != nullptr);
 		return history(peer->id);
 	}
 	inline History *historyLoaded(const PeerData *peer) {
diff --git a/Telegram/SourceFiles/application.cpp b/Telegram/SourceFiles/application.cpp
index d85b8d4d5..2e27d5063 100644
--- a/Telegram/SourceFiles/application.cpp
+++ b/Telegram/SourceFiles/application.cpp
@@ -622,7 +622,7 @@ void connect(const char *signal, QObject *object, const char *method) {
 }
 
 void launch() {
-	t_assert(application() != 0);
+	Assert(application() != 0);
 
 	float64 dpi = Application::primaryScreen()->logicalDotsPerInch();
 	if (dpi <= 108) { // 0-96-108
diff --git a/Telegram/SourceFiles/auth_session.cpp b/Telegram/SourceFiles/auth_session.cpp
index 1834f27ed..08db86bfd 100644
--- a/Telegram/SourceFiles/auth_session.cpp
+++ b/Telegram/SourceFiles/auth_session.cpp
@@ -163,7 +163,7 @@ QString AuthSessionData::getSoundPath(const QString &key) const {
 
 AuthSession &Auth() {
 	auto result = Messenger::Instance().authSession();
-	t_assert(result != nullptr);
+	Assert(result != nullptr);
 	return *result;
 }
 
diff --git a/Telegram/SourceFiles/base/assertion.h b/Telegram/SourceFiles/base/assertion.h
new file mode 100644
index 000000000..34b8f7762
--- /dev/null
+++ b/Telegram/SourceFiles/base/assertion.h
@@ -0,0 +1,71 @@
+/*
+This file is part of Telegram Desktop,
+the official desktop version of Telegram messaging app, see https://telegram.org
+
+Telegram Desktop is free software: you can redistribute it and/or modify
+it under the terms of the GNU General Public License as published by
+the Free Software Foundation, either version 3 of the License, or
+(at your option) any later version.
+
+It is distributed in the hope that it will be useful,
+but WITHOUT ANY WARRANTY; without even the implied warranty of
+MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+GNU General Public License for more details.
+
+In addition, as a special exception, the copyright holders give permission
+to link the code of portions of this program with the OpenSSL library.
+
+Full license: https://github.com/telegramdesktop/tdesktop/blob/master/LICENSE
+Copyright (c) 2014-2017 John Preston, https://desktop.telegram.org
+*/
+#pragma once
+
+#include <cstdlib>
+
+namespace base {
+namespace assertion {
+
+// Client must define that method.
+void log(const char *message, const char *file, int line);
+
+// Release build assertions.
+inline void noop() {
+}
+
+[[noreturn]] inline void fail(const char *message, const char *file, int line) {
+	log(message, file, line);
+
+	// Crash with access violation and generate crash report.
+	volatile auto nullptr_value = (int*)nullptr;
+	*nullptr_value = 0;
+
+	// Silent the possible failure to comply noreturn warning.
+	std::abort();
+}
+
+inline void validate(bool condition, const char *message, const char *file, int line) {
+	(GSL_UNLIKELY(!(condition))) ? fail(message, file, line) : noop();
+}
+
+} // namespace assertion
+} // namespace base
+
+#define AssertCustom(condition, message) (::base::assertion::validate(condition, message, __FILE__, __LINE__))
+#define Assert(condition) AssertCustom(condition, "\"" #condition "\"")
+
+// Define our own versions of Expects() and Ensures().
+// Let them crash with reports and logging.
+#ifdef Expects
+#undef Expects
+#endif // Expects
+#define Expects(condition) (::base::assertion::validate(condition, "\"" #condition "\"", __FILE__, __LINE__))
+
+#ifdef Ensures
+#undef Ensures
+#endif // Ensures
+#define Ensures(condition) (::base::assertion::validate(condition, "\"" #condition "\"", __FILE__, __LINE__))
+
+#ifdef Unexpected
+#undef Unexpected
+#endif // Unexpected
+#define Unexpected(message) (::base::assertion::fail("Unexpected: " message, __FILE__, __LINE__))
diff --git a/Telegram/SourceFiles/base/lambda.h b/Telegram/SourceFiles/base/lambda.h
index 92955d0ca..4c5a645e9 100644
--- a/Telegram/SourceFiles/base/lambda.h
+++ b/Telegram/SourceFiles/base/lambda.h
@@ -357,7 +357,7 @@ public:
 	}
 
 	inline Return operator()(Args... args) {
-		t_assert(data_.vtable != nullptr);
+		Assert(data_.vtable != nullptr);
 		return data_.vtable->call(data_.storage, std::forward<Args>(args)...);
 	}
 
@@ -429,7 +429,7 @@ public:
 	}
 
 	inline Return operator()(Args... args) const {
-		t_assert(this->data_.vtable != nullptr);
+		Assert(this->data_.vtable != nullptr);
 		return this->data_.vtable->const_call(this->data_.storage, std::forward<Args>(args)...);
 	}
 
diff --git a/Telegram/SourceFiles/base/observer.h b/Telegram/SourceFiles/base/observer.h
index 093efdfd0..362c6d42b 100644
--- a/Telegram/SourceFiles/base/observer.h
+++ b/Telegram/SourceFiles/base/observer.h
@@ -437,7 +437,7 @@ protected:
 	void unsubscribe(int index) {
 		if (!index) return;
 		auto count = static_cast<int>(_subscriptions.size());
-		t_assert(index > 0 && index <= count);
+		Assert(index > 0 && index <= count);
 		_subscriptions[index - 1].destroy();
 		if (index == count) {
 			while (index > 0 && !_subscriptions[--index]) {
diff --git a/Telegram/SourceFiles/base/openssl_help.h b/Telegram/SourceFiles/base/openssl_help.h
index 3a2944ddf..357462b86 100644
--- a/Telegram/SourceFiles/base/openssl_help.h
+++ b/Telegram/SourceFiles/base/openssl_help.h
@@ -171,7 +171,7 @@ public:
 		auto length = BN_num_bytes(raw());
 		auto result = base::byte_vector(length, gsl::byte());
 		auto resultSize = BN_bn2bin(raw(), reinterpret_cast<unsigned char*>(result.data()));
-		t_assert(resultSize == length);
+		Assert(resultSize == length);
 		return result;
 	}
 
diff --git a/Telegram/SourceFiles/base/parse_helper.h b/Telegram/SourceFiles/base/parse_helper.h
index c989295e4..064736b89 100644
--- a/Telegram/SourceFiles/base/parse_helper.h
+++ b/Telegram/SourceFiles/base/parse_helper.h
@@ -27,7 +27,7 @@ namespace parse {
 QByteArray stripComments(const QByteArray &content);
 
 inline bool skipWhitespaces(const char *&from, const char *end) {
-	t_assert(from <= end);
+	Assert(from <= end);
 	while (from != end && (
 		(*from == ' ') ||
 		(*from == '\n') ||
@@ -39,7 +39,7 @@ inline bool skipWhitespaces(const char *&from, const char *end) {
 }
 
 inline QLatin1String readName(const char *&from, const char *end) {
-	t_assert(from <= end);
+	Assert(from <= end);
 	auto start = from;
 	while (from != end && (
 		(*from >= 'a' && *from <= 'z') ||
diff --git a/Telegram/SourceFiles/base/runtime_composer.cpp b/Telegram/SourceFiles/base/runtime_composer.cpp
index e17eab90b..c88a1b0ac 100644
--- a/Telegram/SourceFiles/base/runtime_composer.cpp
+++ b/Telegram/SourceFiles/base/runtime_composer.cpp
@@ -37,7 +37,7 @@ const RuntimeComposerMetadata *GetRuntimeComposerMetadata(uint64 mask) {
 	auto i = RuntimeComposerMetadatas.data.constFind(mask);
 	if (i == RuntimeComposerMetadatas.data.cend()) {
 		RuntimeComposerMetadata *meta = new RuntimeComposerMetadata(mask);
-		t_assert(meta != nullptr);
+		Assert(meta != nullptr);
 
 		i = RuntimeComposerMetadatas.data.insert(mask, meta);
 	}
diff --git a/Telegram/SourceFiles/base/runtime_composer.h b/Telegram/SourceFiles/base/runtime_composer.h
index 9da21e4e4..276f26c76 100644
--- a/Telegram/SourceFiles/base/runtime_composer.h
+++ b/Telegram/SourceFiles/base/runtime_composer.h
@@ -70,7 +70,7 @@ struct RuntimeComponent {
 		while (true) {
 			auto last = RuntimeComponentIndexLast.loadAcquire();
 			if (RuntimeComponentIndexLast.testAndSetOrdered(last, last + 1)) {
-				t_assert(last < 64);
+				Assert(last < 64);
 				if (MyIndex.testAndSetOrdered(0, last + 1)) {
 					RuntimeComponentWraps[last] = RuntimeComponentWrapStruct(
 						sizeof(Type),
@@ -154,7 +154,7 @@ public:
 			auto meta = GetRuntimeComposerMetadata(mask);
 
 			auto data = operator new(meta->size);
-			t_assert(data != nullptr);
+			Assert(data != nullptr);
 
 			_data = data;
 			_meta() = meta;
@@ -166,7 +166,7 @@ public:
 						auto space = RuntimeComponentWraps[i].Size;
 						auto alignedAt = constructAt;
 						std::align(RuntimeComponentWraps[i].Align, space, alignedAt, space);
-						t_assert(alignedAt == constructAt);
+						Assert(alignedAt == constructAt);
 						RuntimeComponentWraps[i].Construct(constructAt, this);
 					} catch (...) {
 						while (i > 0) {
diff --git a/Telegram/SourceFiles/base/task_queue.cpp b/Telegram/SourceFiles/base/task_queue.cpp
index 959f3c2d9..02395e481 100644
--- a/Telegram/SourceFiles/base/task_queue.cpp
+++ b/Telegram/SourceFiles/base/task_queue.cpp
@@ -90,7 +90,7 @@ TaskQueue::TaskQueueList::TaskQueueList() {
 }
 
 void TaskQueue::TaskQueueList::Register(TaskQueue *queue) {
-	t_assert(!queue->SerialTaskInProcess());
+	Assert(!queue->SerialTaskInProcess());
 
 	Insert(queue, kAllQueuesList);
 	if (queue->priority_ == Priority::Normal) {
@@ -106,7 +106,7 @@ void TaskQueue::TaskQueueList::Unregister(TaskQueue *queue) {
 }
 
 void TaskQueue::TaskQueueList::Insert(TaskQueue *queue, int list_index_) {
-	t_assert(list_index_ < kQueuesListsCount);
+	Assert(list_index_ < kQueuesListsCount);
 
 	auto tail = Tail();
 	if (lists_[list_index_] == tail) {
@@ -114,7 +114,7 @@ void TaskQueue::TaskQueueList::Insert(TaskQueue *queue, int list_index_) {
 	}
 
 	auto &list_entry = queue->list_entries_[list_index_];
-	t_assert(list_entry.after == nullptr);
+	Assert(list_entry.after == nullptr);
 	if ((list_entry.before = tail->list_entries_[list_index_].before)) {
 		list_entry.before->list_entries_[list_index_].after = queue;
 	}
@@ -123,14 +123,14 @@ void TaskQueue::TaskQueueList::Insert(TaskQueue *queue, int list_index_) {
 }
 
 void TaskQueue::TaskQueueList::Remove(TaskQueue *queue, int list_index_) {
-	t_assert(list_index_ < kQueuesListsCount);
+	Assert(list_index_ < kQueuesListsCount);
 
 	auto &list_entry = queue->list_entries_[list_index_];
-	t_assert(list_entry.after != nullptr);
+	Assert(list_entry.after != nullptr);
 	if (lists_[list_index_] == queue) {
 		lists_[list_index_] = list_entry.after;
 	} else {
-		t_assert(list_entry.before != nullptr);
+		Assert(list_entry.before != nullptr);
 		list_entry.before->list_entries_[list_index_].after = list_entry.after;
 	}
 	list_entry.after->list_entries_[list_index_].before = list_entry.before;
@@ -141,7 +141,7 @@ bool TaskQueue::TaskQueueList::IsInList(TaskQueue *queue) const {
 	if (queue->list_entries_[kAllQueuesList].after) {
 		return true;
 	}
-	t_assert(queue->list_entries_[kOnlyNormalQueuesList].after == nullptr);
+	Assert(queue->list_entries_[kOnlyNormalQueuesList].after == nullptr);
 	return false;
 }
 
@@ -158,15 +158,15 @@ void TaskQueue::TaskQueueList::Clear() {
 }
 
 bool TaskQueue::TaskQueueList::Empty(int list_index_) const {
-	t_assert(list_index_ < kQueuesListsCount);
+	Assert(list_index_ < kQueuesListsCount);
 
 	auto list = lists_[list_index_];
-	t_assert(list != nullptr);
+	Assert(list != nullptr);
 	return (list->list_entries_[list_index_].after == nullptr);
 }
 
 TaskQueue *TaskQueue::TaskQueueList::TakeFirst(int list_index_) {
-	t_assert(!Empty(list_index_));
+	Assert(!Empty(list_index_));
 
 	auto queue = lists_[list_index_];
 	Unregister(queue);
@@ -194,7 +194,7 @@ void TaskQueue::TaskThreadPool::AddQueueTask(TaskQueue *queue, Task &&task) {
 			ThreadFunction();
 		});
 	} else if (some_threads_are_vacant) {
-		t_assert(threads_count > tasks_in_process_);
+		Assert(threads_count > tasks_in_process_);
 		thread_condition_.wakeOne();
 	}
 }
@@ -276,7 +276,7 @@ void TaskQueue::TaskThreadPool::ThreadFunction() {
 			auto take_from_list_ = take_only_normal ? kOnlyNormalQueuesList : kAllQueuesList;
 			auto queue = queue_list_.TakeFirst(take_from_list_);
 
-			t_assert(!queue->tasks_.empty());
+			Assert(!queue->tasks_.empty());
 
 			task = std::move(queue->tasks_.front());
 			queue->tasks_.pop_front();
@@ -285,7 +285,7 @@ void TaskQueue::TaskThreadPool::ThreadFunction() {
 				// Serial queues are returned in the list for processing
 				// only after the task is finished.
 				serial_queue = queue;
-				t_assert(serial_queue->destroyed_flag_ == nullptr);
+				Assert(serial_queue->destroyed_flag_ == nullptr);
 				serial_queue->destroyed_flag_ = &serial_queue_destroyed;
 			} else if (!queue->tasks_.empty()) {
 				queue_list_.Register(queue);
@@ -326,20 +326,20 @@ void TaskQueue::Put(Task &&task) {
 
 		Sandbox::MainThreadTaskAdded();
 	} else {
-		t_assert(type_ != Type::Special);
+		Assert(type_ != Type::Special);
 		TaskThreadPool::Instance()->AddQueueTask(this, std::move(task));
 	}
 }
 
 void TaskQueue::ProcessMainTasks() { // static
-	t_assert(std::this_thread::get_id() == MainThreadId);
+	Assert(std::this_thread::get_id() == MainThreadId);
 
 	while (ProcessOneMainTask()) {
 	}
 }
 
 void TaskQueue::ProcessMainTasks(TimeMs max_time_spent) { // static
-	t_assert(std::this_thread::get_id() == MainThreadId);
+	Assert(std::this_thread::get_id() == MainThreadId);
 
 	auto start_time = getms();
 	while (ProcessOneMainTask()) {
@@ -370,7 +370,7 @@ bool TaskQueue::IsMyThread() const {
 	if (type_ == Type::Main) {
 		return (std::this_thread::get_id() == MainThreadId);
 	}
-	t_assert(type_ != Type::Special);
+	Assert(type_ != Type::Special);
 	return false;
 }
 
diff --git a/Telegram/SourceFiles/base/virtual_method.h b/Telegram/SourceFiles/base/virtual_method.h
index fd85bed88..4edebad4f 100644
--- a/Telegram/SourceFiles/base/virtual_method.h
+++ b/Telegram/SourceFiles/base/virtual_method.h
@@ -84,7 +84,7 @@ template <typename Object, void (*Creator)(const child_entry &)>
 class object_registrator {
 public:
 	inline object_registrator() {
-		t_assert(!first_dispatch_fired());
+		Assert(!first_dispatch_fired());
 		Creator(child_entry {
 			&is_parent<Object>::check,
 			&_index,
@@ -701,7 +701,7 @@ private:
 	class virtual_override_registrator {
 	public:
 		inline virtual_override_registrator() {
-			t_assert(!virtual_methods::first_dispatch_fired());
+			Assert(!virtual_methods::first_dispatch_fired());
 			BaseMethod::template virtual_method_register_override<ConcreteMethod>();
 		}
 
diff --git a/Telegram/SourceFiles/boxes/add_contact_box.cpp b/Telegram/SourceFiles/boxes/add_contact_box.cpp
index 3905a52b8..04d1a890e 100644
--- a/Telegram/SourceFiles/boxes/add_contact_box.cpp
+++ b/Telegram/SourceFiles/boxes/add_contact_box.cpp
@@ -397,7 +397,7 @@ void GroupInfoBox::createGroup(not_null<PeerListBox*> selectUsersBox, const QStr
 	inputs.reserve(users.size());
 	for (auto peer : users) {
 		auto user = peer->asUser();
-		t_assert(user != nullptr);
+		Assert(user != nullptr);
 		if (!user->isSelf()) {
 			inputs.push_back(user->inputUser);
 		}
diff --git a/Telegram/SourceFiles/boxes/calendar_box.cpp b/Telegram/SourceFiles/boxes/calendar_box.cpp
index e18ee7f97..8d4af760e 100644
--- a/Telegram/SourceFiles/boxes/calendar_box.cpp
+++ b/Telegram/SourceFiles/boxes/calendar_box.cpp
@@ -148,7 +148,7 @@ void CalendarBox::Context::skipMonth(int skip) {
 }
 
 int CalendarBox::Context::daysShiftForMonth(QDate month) {
-	t_assert(!month.isNull());
+	Assert(!month.isNull());
 	constexpr auto kMaxRows = 6;
 	auto inMonthIndex = month.day() - 1;
 	auto inWeekIndex = month.dayOfWeek() - 1;
@@ -156,7 +156,7 @@ int CalendarBox::Context::daysShiftForMonth(QDate month) {
 }
 
 int CalendarBox::Context::rowsCountForMonth(QDate month) {
-	t_assert(!month.isNull());
+	Assert(!month.isNull());
 	auto daysShift = daysShiftForMonth(month);
 	auto daysCount = month.daysInMonth();
 	auto cellsCount = daysShift + daysCount;
@@ -360,7 +360,7 @@ void CalendarBox::Inner::mousePressEvent(QMouseEvent *e) {
 	setPressed(_selected);
 	if (_selected != kEmptySelection) {
 		auto index = _selected + _context->daysShift();
-		t_assert(index >= 0);
+		Assert(index >= 0);
 
 		auto row = index / kDaysInWeek;
 		auto col = index % kDaysInWeek;
diff --git a/Telegram/SourceFiles/boxes/confirm_box.cpp b/Telegram/SourceFiles/boxes/confirm_box.cpp
index eedeb4bcf..681a0a7e4 100644
--- a/Telegram/SourceFiles/boxes/confirm_box.cpp
+++ b/Telegram/SourceFiles/boxes/confirm_box.cpp
@@ -430,7 +430,7 @@ DeleteMessagesBox::DeleteMessagesBox(QWidget*, HistoryItem *item, bool suggestMo
 
 DeleteMessagesBox::DeleteMessagesBox(QWidget*, const SelectedItemSet &selected) {
 	auto count = selected.size();
-	t_assert(count > 0);
+	Assert(count > 0);
 	_ids.reserve(count);
 	for_const (auto item, selected) {
 		_ids.push_back(item->fullId());
@@ -440,7 +440,7 @@ DeleteMessagesBox::DeleteMessagesBox(QWidget*, const SelectedItemSet &selected)
 void DeleteMessagesBox::prepare() {
 	auto text = QString();
 	if (_moderateFrom) {
-		t_assert(_moderateInChannel != nullptr);
+		Assert(_moderateInChannel != nullptr);
 		text = lang(lng_selected_delete_sure_this);
 		if (_moderateBan) {
 			_banUser.create(this, lang(lng_ban_user), false, st::defaultBoxCheckbox);
diff --git a/Telegram/SourceFiles/boxes/edit_participant_box.cpp b/Telegram/SourceFiles/boxes/edit_participant_box.cpp
index 589adbf0f..b4098ddd0 100644
--- a/Telegram/SourceFiles/boxes/edit_participant_box.cpp
+++ b/Telegram/SourceFiles/boxes/edit_participant_box.cpp
@@ -118,7 +118,7 @@ void EditParticipantBox::Inner::removeControl(QPointer<TWidget> widget) {
 	auto row = std::find_if(_rows.begin(), _rows.end(), [widget](auto &&row) {
 		return (row.widget == widget);
 	});
-	t_assert(row != _rows.end());
+	Assert(row != _rows.end());
 	row->widget.destroy();
 	_rows.erase(row);
 }
@@ -250,7 +250,7 @@ void EditAdminBox::prepare() {
 	auto addAdmins = _checkboxes.find(Flag::f_add_admins);
 	if (addAdmins != _checkboxes.end()) {
 		_aboutAddAdmins = addControl(object_ptr<Ui::FlatLabel>(this, st::boxLabel), st::rightsAboutMargin);
-		t_assert(addAdmins != _checkboxes.end());
+		Assert(addAdmins != _checkboxes.end());
 		subscribe(addAdmins->second->checkedChanged, [this](bool checked) {
 			refreshAboutAddAdminsText();
 		});
@@ -295,7 +295,7 @@ void EditAdminBox::applyDependencies(QPointer<Ui::Checkbox> changed) {
 
 void EditAdminBox::refreshAboutAddAdminsText() {
 	auto addAdmins = _checkboxes.find(Flag::f_add_admins);
-	t_assert(addAdmins != _checkboxes.end());
+	Assert(addAdmins != _checkboxes.end());
 	auto text = [this, addAdmins] {
 		if (!canSave()) {
 			return lang(lng_rights_about_admin_cant_edit);
@@ -480,6 +480,6 @@ TimeId EditRestrictedBox::getRealUntilValue() const {
 	} else if (_until == kUntilOneWeek) {
 		return unixtime() + kSecondsInWeek;
 	}
-	t_assert(_until >= 0);
+	Assert(_until >= 0);
 	return _until;
 }
diff --git a/Telegram/SourceFiles/boxes/edit_privacy_box.cpp b/Telegram/SourceFiles/boxes/edit_privacy_box.cpp
index a9137d2f6..16f40322b 100644
--- a/Telegram/SourceFiles/boxes/edit_privacy_box.cpp
+++ b/Telegram/SourceFiles/boxes/edit_privacy_box.cpp
@@ -66,7 +66,7 @@ std::vector<not_null<UserData*>> PrivacyExceptionsBoxController::getResult() con
 		users.reserve(peers.size());
 		for_const (auto peer, peers) {
 			auto user = peer->asUser();
-			t_assert(user != nullptr);
+			Assert(user != nullptr);
 			users.push_back(user);
 		}
 	}
diff --git a/Telegram/SourceFiles/boxes/peer_list_box.cpp b/Telegram/SourceFiles/boxes/peer_list_box.cpp
index 9afaf4896..1bbdba798 100644
--- a/Telegram/SourceFiles/boxes/peer_list_box.cpp
+++ b/Telegram/SourceFiles/boxes/peer_list_box.cpp
@@ -278,10 +278,10 @@ void PeerListController::search(const QString &query) {
 
 void PeerListController::peerListSearchAddRow(not_null<PeerData*> peer) {
 	if (auto row = delegate()->peerListFindRow(peer->id)) {
-		t_assert(row->id() == row->peer()->id);
+		Assert(row->id() == row->peer()->id);
 		delegate()->peerListAppendFoundRow(row);
 	} else if (auto row = createSearchRow(peer)) {
-		t_assert(row->id() == row->peer()->id);
+		Assert(row->id() == row->peer()->id);
 		delegate()->peerListAppendSearchRow(std::move(row));
 	}
 }
@@ -585,7 +585,7 @@ void PeerListBox::Inner::addRowEntry(not_null<PeerListRow*> row) {
 		addToSearchIndex(row);
 	}
 	if (_controller->isRowSelected(row->peer())) {
-		t_assert(row->id() == row->peer()->id);
+		Assert(row->id() == row->peer()->id);
 		changeCheckState(row, true, PeerListRow::SetStyle::Fast);
 	}
 }
@@ -643,10 +643,10 @@ void PeerListBox::Inner::prependRowFromSearchResult(not_null<PeerListRow*> row)
 	if (!row->isSearchResult()) {
 		return;
 	}
-	t_assert(_rowsById.find(row->id()) != _rowsById.cend());
+	Assert(_rowsById.find(row->id()) != _rowsById.cend());
 	auto index = row->absoluteIndex();
-	t_assert(index >= 0 && index < _searchRows.size());
-	t_assert(_searchRows[index].get() == row);
+	Assert(index >= 0 && index < _searchRows.size());
+	Assert(_searchRows[index].get() == row);
 
 	row->setIsSearchResult(false);
 	_rows.insert(_rows.begin(), std::move(_searchRows[index]));
@@ -682,8 +682,8 @@ void PeerListBox::Inner::removeRow(not_null<PeerListRow*> row) {
 	auto isSearchResult = row->isSearchResult();
 	auto &eraseFrom = isSearchResult ? _searchRows : _rows;
 
-	t_assert(index >= 0 && index < eraseFrom.size());
-	t_assert(eraseFrom[index].get() == row);
+	Assert(index >= 0 && index < eraseFrom.size());
+	Assert(eraseFrom[index].get() == row);
 
 	setSelected(Selected());
 	setPressed(Selected());
@@ -705,8 +705,8 @@ void PeerListBox::Inner::convertRowToSearchResult(not_null<PeerListRow*> row) {
 		return removeRow(row);
 	}
 	auto index = row->absoluteIndex();
-	t_assert(index >= 0 && index < _rows.size());
-	t_assert(_rows[index].get() == row);
+	Assert(index >= 0 && index < _rows.size());
+	Assert(_rows[index].get() == row);
 
 	removeFromSearchIndex(row);
 	row->setIsSearchResult(true);
@@ -925,7 +925,7 @@ void PeerListBox::Inner::setPressed(Selected pressed) {
 
 void PeerListBox::Inner::paintRow(Painter &p, TimeMs ms, RowIndex index) {
 	auto row = getRow(index);
-	t_assert(row != nullptr);
+	Assert(row != nullptr);
 	row->lazyInitialize();
 
 	auto peer = row->peer();
@@ -1016,8 +1016,8 @@ void PeerListBox::Inner::selectSkip(int direction) {
 		lastEnabled = firstEnabled - 1;
 	}
 
-	t_assert(lastEnabled < rowsCount);
-	t_assert(firstEnabled - 1 <= lastEnabled);
+	Assert(lastEnabled < rowsCount);
+	Assert(firstEnabled - 1 <= lastEnabled);
 
 	// Always pass through the first enabled item when changing from / to none selected.
 	if ((_selected.index.value > firstEnabled && newSelectedIndex < firstEnabled)
@@ -1037,7 +1037,7 @@ void PeerListBox::Inner::selectSkip(int direction) {
 		auto delta = (direction > 0) ? 1 : -1;
 		for (newSelectedIndex += delta; ; newSelectedIndex += delta) {
 			// We must find an enabled row, firstEnabled <= us <= lastEnabled.
-			t_assert(newSelectedIndex >= 0 && newSelectedIndex < rowsCount);
+			Assert(newSelectedIndex >= 0 && newSelectedIndex < rowsCount);
 			if (!getRow(RowIndex(newSelectedIndex))->disabled()) {
 				break;
 			}
@@ -1253,17 +1253,17 @@ bool PeerListBox::Inner::enumerateShownRows(Callback callback) {
 
 template <typename Callback>
 bool PeerListBox::Inner::enumerateShownRows(int from, int to, Callback callback) {
-	t_assert(0 <= from);
-	t_assert(from <= to);
+	Assert(0 <= from);
+	Assert(from <= to);
 	if (showingSearch()) {
-		t_assert(to <= _filterResults.size());
+		Assert(to <= _filterResults.size());
 		for (auto i = from; i != to; ++i) {
 			if (!callback(_filterResults[i])) {
 				return false;
 			}
 		}
 	} else {
-		t_assert(to <= _rows.size());
+		Assert(to <= _rows.size());
 		for (auto i = from; i != to; ++i) {
 			if (!callback(_rows[i].get())) {
 				return false;
@@ -1288,7 +1288,7 @@ PeerListRow *PeerListBox::Inner::getRow(RowIndex index) {
 
 PeerListBox::Inner::RowIndex PeerListBox::Inner::findRowIndex(not_null<PeerListRow*> row, RowIndex hint) {
 	if (!showingSearch()) {
-		t_assert(!row->isSearchResult());
+		Assert(!row->isSearchResult());
 		return RowIndex(row->absoluteIndex());
 	}
 
diff --git a/Telegram/SourceFiles/boxes/peer_list_controllers.cpp b/Telegram/SourceFiles/boxes/peer_list_controllers.cpp
index dfc0115f2..27d154bf7 100644
--- a/Telegram/SourceFiles/boxes/peer_list_controllers.cpp
+++ b/Telegram/SourceFiles/boxes/peer_list_controllers.cpp
@@ -445,8 +445,8 @@ void AddParticipantsBoxController::Start(not_null<ChatData*> chat) {
 				auto users = std::vector<not_null<UserData*>>();
 				for (auto peer : rows) {
 					auto user = peer->asUser();
-					t_assert(user != nullptr);
-					t_assert(!user->isSelf());
+					Assert(user != nullptr);
+					Assert(!user->isSelf());
 					users.push_back(peer->asUser());
 				}
 				App::main()->addParticipants(chat, users);
@@ -470,8 +470,8 @@ void AddParticipantsBoxController::Start(
 				auto users = std::vector<not_null<UserData*>>();
 				for (auto peer : rows) {
 					auto user = peer->asUser();
-					t_assert(user != nullptr);
-					t_assert(!user->isSelf());
+					Assert(user != nullptr);
+					Assert(!user->isSelf());
 					users.push_back(peer->asUser());
 				}
 				App::main()->addParticipants(channel, users);
@@ -673,8 +673,8 @@ void EditChatAdminsBoxController::Start(not_null<ChatData*> chat) {
 				auto users = std::vector<not_null<UserData*>>();
 				for (auto peer : rows) {
 					auto user = peer->asUser();
-					t_assert(user != nullptr);
-					t_assert(!user->isSelf());
+					Assert(user != nullptr);
+					Assert(!user->isSelf());
 					users.push_back(peer->asUser());
 				}
 				Auth().api().editChatAdmins(chat, !controller->allAreAdmins(), { users.cbegin(), users.cend() });
diff --git a/Telegram/SourceFiles/boxes/send_files_box.cpp b/Telegram/SourceFiles/boxes/send_files_box.cpp
index 33f99daaf..364d15f56 100644
--- a/Telegram/SourceFiles/boxes/send_files_box.cpp
+++ b/Telegram/SourceFiles/boxes/send_files_box.cpp
@@ -561,7 +561,7 @@ EditCaptionBox::EditCaptionBox(QWidget*, HistoryMedia *media, FullMsgId msgId) :
 		_thumb = App::pixmapFromImageInPlace(_thumb.toImage().scaled(_thumbw * cIntRetinaFactor(), _thumbh * cIntRetinaFactor(), Qt::IgnoreAspectRatio, Qt::SmoothTransformation));
 		_thumb.setDevicePixelRatio(cRetinaFactor());
 	}
-	t_assert(_animated || _photo || _doc);
+	Assert(_animated || _photo || _doc);
 
 	_field.create(this, st::confirmCaptionArea, langFactory(lng_photo_caption), caption);
 	_field->setMaxLength(MaxPhotoCaption);
diff --git a/Telegram/SourceFiles/boxes/sticker_set_box.cpp b/Telegram/SourceFiles/boxes/sticker_set_box.cpp
index ff712278f..087f8a5d0 100644
--- a/Telegram/SourceFiles/boxes/sticker_set_box.cpp
+++ b/Telegram/SourceFiles/boxes/sticker_set_box.cpp
@@ -361,7 +361,7 @@ void StickerSetBox::Inner::paintEvent(QPaintEvent *e) {
 		for (int32 j = 0; j < kStickersPanelPerRow; ++j) {
 			int32 index = i * kStickersPanelPerRow + j;
 			if (index >= _pack.size()) break;
-			t_assert(index < _packOvers.size());
+			Assert(index < _packOvers.size());
 
 			DocumentData *doc = _pack.at(index);
 			QPoint pos(st::stickersPadding.left() + j * st::stickersSize.width(), st::stickersPadding.top() + i * st::stickersSize.height());
diff --git a/Telegram/SourceFiles/boxes/stickers_box.cpp b/Telegram/SourceFiles/boxes/stickers_box.cpp
index 90c8dfd91..2474b0882 100644
--- a/Telegram/SourceFiles/boxes/stickers_box.cpp
+++ b/Telegram/SourceFiles/boxes/stickers_box.cpp
@@ -132,7 +132,7 @@ object_ptr<StickersBox::Inner> StickersBox::Tab::takeWidget() {
 
 void StickersBox::Tab::returnWidget(object_ptr<Inner> widget) {
 	_widget = std::move(widget);
-	t_assert(_widget == _weak);
+	Assert(_widget == _weak);
 }
 
 void StickersBox::Tab::saveScrollTop() {
@@ -404,7 +404,7 @@ void StickersBox::switchTab() {
 	if (!_tabs) return;
 
 	auto tab = _tabs->activeSection();
-	t_assert(tab >= 0 && tab < _tabIndices.size());
+	Assert(tab >= 0 && tab < _tabIndices.size());
 	auto newSection = _tabIndices[tab];
 
 	auto newTab = _tab;
diff --git a/Telegram/SourceFiles/calls/calls_box_controller.cpp b/Telegram/SourceFiles/calls/calls_box_controller.cpp
index dca17afd8..380e03ef4 100644
--- a/Telegram/SourceFiles/calls/calls_box_controller.cpp
+++ b/Telegram/SourceFiles/calls/calls_box_controller.cpp
@@ -251,7 +251,7 @@ void BoxController::rowClicked(not_null<PeerListRow*> row) {
 
 void BoxController::rowActionClicked(not_null<PeerListRow*> row) {
 	auto user = row->peer()->asUser();
-	t_assert(user != nullptr);
+	Assert(user != nullptr);
 
 	Current().startOutgoingCall(user);
 }
@@ -323,7 +323,7 @@ BoxController::Row *BoxController::rowForItem(HistoryItem *item) {
 		// In that case we sometimes need to return rowAt(left + 1), not rowAt(left).
 		if (result->minItemId() > itemId && left + 1 < fullRowsCount) {
 			auto possibleResult = static_cast<Row*>(v->peerListRowAt(left + 1).get());
-			t_assert(possibleResult->maxItemId() < itemId);
+			Assert(possibleResult->maxItemId() < itemId);
 			if (possibleResult->canAddItem(item)) {
 				return possibleResult;
 			}
diff --git a/Telegram/SourceFiles/calls/calls_call.cpp b/Telegram/SourceFiles/calls/calls_call.cpp
index 84c664200..17eebdd4c 100644
--- a/Telegram/SourceFiles/calls/calls_call.cpp
+++ b/Telegram/SourceFiles/calls/calls_call.cpp
@@ -118,8 +118,8 @@ void Call::start(base::const_byte_span random) {
 	// Save config here, because it is possible that it changes between
 	// different usages inside the same call.
 	_dhConfig = _delegate->getDhConfig();
-	t_assert(_dhConfig.g != 0);
-	t_assert(!_dhConfig.p.empty());
+	Assert(_dhConfig.g != 0);
+	Assert(!_dhConfig.p.empty());
 
 	generateModExpFirst(random);
 	if (_state == State::Starting || _state == State::Requesting) {
@@ -242,7 +242,7 @@ void Call::redial() {
 	if (_state != State::Busy) {
 		return;
 	}
-	t_assert(_controller == nullptr);
+	Assert(_controller == nullptr);
 	_type = Type::Outgoing;
 	setState(State::Requesting);
 	_answerAfterDhConfigReceived = false;
diff --git a/Telegram/SourceFiles/calls/calls_emoji_fingerprint.cpp b/Telegram/SourceFiles/calls/calls_emoji_fingerprint.cpp
index 0c0b0d929..334956654 100644
--- a/Telegram/SourceFiles/calls/calls_emoji_fingerprint.cpp
+++ b/Telegram/SourceFiles/calls/calls_emoji_fingerprint.cpp
@@ -134,7 +134,7 @@ std::vector<EmojiPtr> ComputeEmojiFingerprint(not_null<Call*> call) {
 		auto size = Offsets[index + 1] - offset;
 		auto string = QString::fromRawData(reinterpret_cast<QChar*>(Data + offset), size);
 		auto emoji = Ui::Emoji::Find(string);
-		t_assert(emoji != nullptr);
+		Assert(emoji != nullptr);
 	}
 	if (call->isKeyShaForFingerprintReady()) {
 		auto sha256 = call->getKeyShaForFingerprint();
@@ -146,7 +146,7 @@ std::vector<EmojiPtr> ComputeEmojiFingerprint(not_null<Call*> call) {
 			auto size = Offsets[index + 1] - offset;
 			auto string = QString::fromRawData(reinterpret_cast<QChar*>(Data + offset), size);
 			auto emoji = Ui::Emoji::Find(string);
-			t_assert(emoji != nullptr);
+			Assert(emoji != nullptr);
 			result.push_back(emoji);
 		}
 	}
diff --git a/Telegram/SourceFiles/calls/calls_panel.cpp b/Telegram/SourceFiles/calls/calls_panel.cpp
index c13facca0..2a7aa37a9 100644
--- a/Telegram/SourceFiles/calls/calls_panel.cpp
+++ b/Telegram/SourceFiles/calls/calls_panel.cpp
@@ -85,10 +85,10 @@ Panel::Button::Button(QWidget *parent, const style::CallButton &stFrom, const st
 	_bgMask = prepareRippleMask();
 	_bgFrom = App::pixmapFromImageInPlace(style::colorizeImage(_bgMask, _stFrom->bg));
 	if (_stTo) {
-		t_assert(_stFrom->button.width == _stTo->button.width);
-		t_assert(_stFrom->button.height == _stTo->button.height);
-		t_assert(_stFrom->button.rippleAreaPosition == _stTo->button.rippleAreaPosition);
-		t_assert(_stFrom->button.rippleAreaSize == _stTo->button.rippleAreaSize);
+		Assert(_stFrom->button.width == _stTo->button.width);
+		Assert(_stFrom->button.height == _stTo->button.height);
+		Assert(_stFrom->button.rippleAreaPosition == _stTo->button.rippleAreaPosition);
+		Assert(_stFrom->button.rippleAreaSize == _stTo->button.rippleAreaSize);
 
 		_bg = QImage(_bgMask.size(), QImage::Format_ARGB32_Premultiplied);
 		_bg.setDevicePixelRatio(cRetinaFactor());
diff --git a/Telegram/SourceFiles/chat_helpers/emoji_suggestions_widget.cpp b/Telegram/SourceFiles/chat_helpers/emoji_suggestions_widget.cpp
index 38c99436a..e2914d7b0 100644
--- a/Telegram/SourceFiles/chat_helpers/emoji_suggestions_widget.cpp
+++ b/Telegram/SourceFiles/chat_helpers/emoji_suggestions_widget.cpp
@@ -430,7 +430,7 @@ QString SuggestionsController::getEmojiQuery() {
 	auto isGoodCharBeforeSuggestion = [isSuggestionChar](QChar ch) {
 		return !isSuggestionChar(ch) || (ch == 0);
 	};
-	t_assert(position > 0 && position <= text.size());
+	Assert(position > 0 && position <= text.size());
 	for (auto i = position; i != 0;) {
 		auto ch = text[--i];
 		if (ch == ':') {
diff --git a/Telegram/SourceFiles/chat_helpers/gifs_list_widget.cpp b/Telegram/SourceFiles/chat_helpers/gifs_list_widget.cpp
index 5e91e0bb1..64a5bc9d4 100644
--- a/Telegram/SourceFiles/chat_helpers/gifs_list_widget.cpp
+++ b/Telegram/SourceFiles/chat_helpers/gifs_list_widget.cpp
@@ -380,7 +380,7 @@ void GifsListWidget::enterFromChildEvent(QEvent *e, QWidget *child) {
 void GifsListWidget::clearSelection() {
 	if (_selected >= 0) {
 		int srow = _selected / MatrixRowShift, scol = _selected % MatrixRowShift;
-		t_assert(srow >= 0 && srow < _rows.size() && scol >= 0 && scol < _rows[srow].items.size());
+		Assert(srow >= 0 && srow < _rows.size() && scol >= 0 && scol < _rows[srow].items.size());
 		ClickHandler::clearActive(_rows[srow].items[scol]);
 		setCursor(style::cur_default);
 	}
@@ -564,7 +564,7 @@ void GifsListWidget::deleteUnusedInlineLayouts() {
 
 GifsListWidget::Row &GifsListWidget::layoutInlineRow(Row &row, int32 sumWidth) {
 	auto count = int(row.items.size());
-	t_assert(count <= kInlineItemsMaxPerRow);
+	Assert(count <= kInlineItemsMaxPerRow);
 
 	// enumerate items in the order of growing maxWidth()
 	// for that sort item indices by maxWidth()
@@ -740,7 +740,7 @@ bool GifsListWidget::inlineItemVisible(const InlineBots::Layout::ItemBase *layou
 
 	auto row = position / MatrixRowShift;
 	auto col = position % MatrixRowShift;
-	t_assert((row < _rows.size()) && (col < _rows[row].items.size()));
+	Assert((row < _rows.size()) && (col < _rows[row].items.size()));
 
 	auto &inlineItems = _rows[row].items;
 	auto top = 0;
@@ -912,12 +912,12 @@ void GifsListWidget::updateSelected() {
 	int scol = (_selected >= 0) ? (_selected % MatrixRowShift) : -1;
 	if (_selected != sel) {
 		if (srow >= 0 && scol >= 0) {
-			t_assert(srow >= 0 && srow < _rows.size() && scol >= 0 && scol < _rows[srow].items.size());
+			Assert(srow >= 0 && srow < _rows.size() && scol >= 0 && scol < _rows[srow].items.size());
 			_rows[srow].items[scol]->update();
 		}
 		_selected = sel;
 		if (row >= 0 && col >= 0) {
-			t_assert(row >= 0 && row < _rows.size() && col >= 0 && col < _rows[row].items.size());
+			Assert(row >= 0 && row < _rows.size() && col >= 0 && col < _rows[row].items.size());
 			_rows[row].items[col]->update();
 		}
 		if (_previewShown && _selected >= 0 && _pressed != _selected) {
diff --git a/Telegram/SourceFiles/chat_helpers/stickers.cpp b/Telegram/SourceFiles/chat_helpers/stickers.cpp
index d3043ff85..2610ec283 100644
--- a/Telegram/SourceFiles/chat_helpers/stickers.cpp
+++ b/Telegram/SourceFiles/chat_helpers/stickers.cpp
@@ -406,7 +406,7 @@ void SetPackAndEmoji(Set &set, StickerPack &&pack, const QVector<MTPStickerPack>
 	set.stickers = std::move(pack);
 	set.emoji.clear();
 	for_const (auto &mtpPack, packs) {
-		t_assert(mtpPack.type() == mtpc_stickerPack);
+		Assert(mtpPack.type() == mtpc_stickerPack);
 		auto &pack = mtpPack.c_stickerPack();
 		if (auto emoji = Ui::Emoji::Find(qs(pack.vemoticon))) {
 			emoji = emoji->original();
diff --git a/Telegram/SourceFiles/chat_helpers/stickers_list_widget.cpp b/Telegram/SourceFiles/chat_helpers/stickers_list_widget.cpp
index 6b8650fea..34b5fa843 100644
--- a/Telegram/SourceFiles/chat_helpers/stickers_list_widget.cpp
+++ b/Telegram/SourceFiles/chat_helpers/stickers_list_widget.cpp
@@ -876,7 +876,7 @@ bool StickersListWidget::hasRemoveButton(int index) const {
 		return true;
 	}
 	if (set.id == Stickers::MegagroupSetId) {
-		t_assert(_megagroupSet != nullptr);
+		Assert(_megagroupSet != nullptr);
 		if (index + 1 != _mySets.size()) {
 			return true;
 		}
@@ -908,7 +908,7 @@ void StickersListWidget::mousePressEvent(QMouseEvent *e) {
 void StickersListWidget::setPressed(OverState newPressed) {
 	if (auto button = base::get_if<OverButton>(&_pressed)) {
 		auto &sets = shownSets();
-		t_assert(button->section >= 0 && button->section < sets.size());
+		Assert(button->section >= 0 && button->section < sets.size());
 		auto &set = sets[button->section];
 		if (set.ripple) {
 			set.ripple->lastStop();
@@ -921,7 +921,7 @@ void StickersListWidget::setPressed(OverState newPressed) {
 	_pressed = newPressed;
 	if (auto button = base::get_if<OverButton>(&_pressed)) {
 		auto &sets = shownSets();
-		t_assert(button->section >= 0 && button->section < sets.size());
+		Assert(button->section >= 0 && button->section < sets.size());
 		auto &set = sets[button->section];
 		if (!set.ripple) {
 			set.ripple = createButtonRipple(button->section);
@@ -996,9 +996,9 @@ void StickersListWidget::mouseReleaseEvent(QMouseEvent *e) {
 	auto &sets = shownSets();
 	if (pressed && pressed == _selected) {
 		if (auto sticker = base::get_if<OverSticker>(&pressed)) {
-			t_assert(sticker->section >= 0 && sticker->section < sets.size());
+			Assert(sticker->section >= 0 && sticker->section < sets.size());
 			auto &set = sets[sticker->section];
-			t_assert(sticker->index >= 0 && sticker->index < set.pack.size());
+			Assert(sticker->index >= 0 && sticker->index < set.pack.size());
 			if (stickerHasDeleteButton(set, sticker->index) && sticker->overDelete) {
 				if (set.id == Stickers::RecentSetId) {
 					removeRecentSticker(sticker->section, sticker->index);
@@ -1011,10 +1011,10 @@ void StickersListWidget::mouseReleaseEvent(QMouseEvent *e) {
 			}
 			emit selected(set.pack[sticker->index]);
 		} else if (auto set = base::get_if<OverSet>(&pressed)) {
-			t_assert(set->section >= 0 && set->section < sets.size());
+			Assert(set->section >= 0 && set->section < sets.size());
 			displaySet(sets[set->section].id);
 		} else if (auto button = base::get_if<OverButton>(&pressed)) {
-			t_assert(button->section >= 0 && button->section < sets.size());
+			Assert(button->section >= 0 && button->section < sets.size());
 			if (_section == Section::Featured) {
 				installSet(sets[button->section].id);
 			} else if (sets[button->section].id == Stickers::MegagroupSetId) {
@@ -1479,7 +1479,7 @@ bool StickersListWidget::setHasTitle(const Set &set) const {
 
 bool StickersListWidget::stickerHasDeleteButton(const Set &set, int index) const {
 	if (set.id == Stickers::RecentSetId) {
-		t_assert(index >= 0 && index < _custom.size());
+		Assert(index >= 0 && index < _custom.size());
 		return _custom[index];
 	}
 	return (set.id == Stickers::FavedSetId);
@@ -1508,9 +1508,9 @@ void StickersListWidget::setSelected(OverState newSelected) {
 		if (_previewShown && _pressed != _selected) {
 			if (auto sticker = base::get_if<OverSticker>(&_selected)) {
 				_pressed = _selected;
-				t_assert(sticker->section >= 0 && sticker->section < sets.size());
+				Assert(sticker->section >= 0 && sticker->section < sets.size());
 				auto &set = sets[sticker->section];
-				t_assert(sticker->index >= 0 && sticker->index < set.pack.size());
+				Assert(sticker->index >= 0 && sticker->index < set.pack.size());
 				Ui::showMediaPreview(set.pack[sticker->index]);
 			}
 		}
@@ -1524,9 +1524,9 @@ void StickersListWidget::onSettings() {
 void StickersListWidget::onPreview() {
 	if (auto sticker = base::get_if<OverSticker>(&_pressed)) {
 		auto &sets = shownSets();
-		t_assert(sticker->section >= 0 && sticker->section < sets.size());
+		Assert(sticker->section >= 0 && sticker->section < sets.size());
 		auto &set = sets[sticker->section];
-		t_assert(sticker->index >= 0 && sticker->index < set.pack.size());
+		Assert(sticker->index >= 0 && sticker->index < set.pack.size());
 		Ui::showMediaPreview(set.pack[sticker->index]);
 		_previewShown = true;
 	}
diff --git a/Telegram/SourceFiles/chat_helpers/tabbed_panel.cpp b/Telegram/SourceFiles/chat_helpers/tabbed_panel.cpp
index 84b8118f8..128531b2d 100644
--- a/Telegram/SourceFiles/chat_helpers/tabbed_panel.cpp
+++ b/Telegram/SourceFiles/chat_helpers/tabbed_panel.cpp
@@ -143,7 +143,7 @@ void TabbedPanel::paintEvent(QPaintEvent *e) {
 	}
 
 	if (showAnimating) {
-		t_assert(_showAnimation != nullptr);
+		Assert(_showAnimation != nullptr);
 		if (auto opacity = _a_opacity.current(_hiding ? 0. : 1.)) {
 			_showAnimation->paintFrame(p, 0, 0, width(), _a_show.current(1.), opacity);
 		}
diff --git a/Telegram/SourceFiles/chat_helpers/tabbed_selector.cpp b/Telegram/SourceFiles/chat_helpers/tabbed_selector.cpp
index 81d1873e2..9f7e7158c 100644
--- a/Telegram/SourceFiles/chat_helpers/tabbed_selector.cpp
+++ b/Telegram/SourceFiles/chat_helpers/tabbed_selector.cpp
@@ -85,24 +85,24 @@ void TabbedSelector::SlideAnimation::setFinalImages(Direction direction, QImage
 	_leftImage = QPixmap::fromImage(std::move(left).convertToFormat(QImage::Format_ARGB32_Premultiplied), Qt::ColorOnly);
 	_rightImage = QPixmap::fromImage(std::move(right).convertToFormat(QImage::Format_ARGB32_Premultiplied), Qt::ColorOnly);
 
-	t_assert(!_leftImage.isNull());
-	t_assert(!_rightImage.isNull());
+	Assert(!_leftImage.isNull());
+	Assert(!_rightImage.isNull());
 	_width = _leftImage.width();
 	_height = _rightImage.height();
-	t_assert(!(_width % cIntRetinaFactor()));
-	t_assert(!(_height % cIntRetinaFactor()));
-	t_assert(_leftImage.devicePixelRatio() == _rightImage.devicePixelRatio());
-	t_assert(_rightImage.width() == _width);
-	t_assert(_rightImage.height() == _height);
-	t_assert(QRect(0, 0, _width, _height).contains(inner));
+	Assert(!(_width % cIntRetinaFactor()));
+	Assert(!(_height % cIntRetinaFactor()));
+	Assert(_leftImage.devicePixelRatio() == _rightImage.devicePixelRatio());
+	Assert(_rightImage.width() == _width);
+	Assert(_rightImage.height() == _height);
+	Assert(QRect(0, 0, _width, _height).contains(inner));
 	_innerLeft = inner.x();
 	_innerTop = inner.y();
 	_innerWidth = inner.width();
 	_innerHeight = inner.height();
-	t_assert(!(_innerLeft % cIntRetinaFactor()));
-	t_assert(!(_innerTop % cIntRetinaFactor()));
-	t_assert(!(_innerWidth % cIntRetinaFactor()));
-	t_assert(!(_innerHeight % cIntRetinaFactor()));
+	Assert(!(_innerLeft % cIntRetinaFactor()));
+	Assert(!(_innerTop % cIntRetinaFactor()));
+	Assert(!(_innerWidth % cIntRetinaFactor()));
+	Assert(!(_innerHeight % cIntRetinaFactor()));
 	_innerRight = _innerLeft + _innerWidth;
 	_innerBottom = _innerTop + _innerHeight;
 
@@ -118,13 +118,13 @@ void TabbedSelector::SlideAnimation::setFinalImages(Direction direction, QImage
 }
 
 void TabbedSelector::SlideAnimation::start() {
-	t_assert(!_leftImage.isNull());
-	t_assert(!_rightImage.isNull());
+	Assert(!_leftImage.isNull());
+	Assert(!_rightImage.isNull());
 	RoundShadowAnimation::start(_width, _height, _leftImage.devicePixelRatio());
 	auto checkCorner = [this](const Corner &corner) {
 		if (!corner.valid()) return;
-		t_assert(corner.width <= _innerWidth);
-		t_assert(corner.height <= _innerHeight);
+		Assert(corner.width <= _innerWidth);
+		Assert(corner.height <= _innerHeight);
 	};
 	checkCorner(_topLeft);
 	checkCorner(_topRight);
@@ -617,7 +617,7 @@ bool TabbedSelector::hasSectionIcons() const {
 
 void TabbedSelector::switchTab() {
 	auto tab = _tabsSlider->activeSection();
-	t_assert(tab >= 0 && tab < Tab::kCount);
+	Assert(tab >= 0 && tab < Tab::kCount);
 	auto newTabType = static_cast<SelectorTab>(tab);
 	if (_currentTabType == newTabType) {
 		return;
diff --git a/Telegram/SourceFiles/codegen/scheme/codegen_scheme.py b/Telegram/SourceFiles/codegen/scheme/codegen_scheme.py
index fac072a2b..a05e42dda 100644
--- a/Telegram/SourceFiles/codegen/scheme/codegen_scheme.py
+++ b/Telegram/SourceFiles/codegen/scheme/codegen_scheme.py
@@ -625,7 +625,7 @@ for restype in typesList:
       getters += '\tconst MTPD' + name + ' &c_' + name + '() const;\n'; # const getter
       constructsBodies += 'const MTPD' + name + ' &MTP' + restype + '::c_' + name + '() const {\n';
       if (withType):
-        constructsBodies += '\tt_assert(_type == mtpc_' + name + ');\n';
+        constructsBodies += '\tAssert(_type == mtpc_' + name + ');\n';
       constructsBodies += '\treturn queryData<MTPD' + name + '>();\n';
       constructsBodies += '}\n';
 
@@ -770,7 +770,7 @@ for restype in typesList:
   typesText += '\tmtpTypeId type() const;\n'; # type id method
   methods += 'mtpTypeId MTP' + restype + '::type() const {\n';
   if (withType):
-    methods += '\tt_assert(_type != 0);\n';
+    methods += '\tAssert(_type != 0);\n';
     methods += '\treturn _type;\n';
   else:
     methods += '\treturn mtpc_' + v[0][0] + ';\n';
diff --git a/Telegram/SourceFiles/codegen/style/generator.cpp b/Telegram/SourceFiles/codegen/style/generator.cpp
index 0ecc586a3..7d01c6c52 100644
--- a/Telegram/SourceFiles/codegen/style/generator.cpp
+++ b/Telegram/SourceFiles/codegen/style/generator.cpp
@@ -748,8 +748,8 @@ int palette::indexOfColor(style::color c) const {\n\
 }\n\
 \n\
 color palette::colorAtIndex(int index) const {\n\
-	t_assert(_ready);\n\
-	t_assert(index >= 0 && index < kCount);\n\
+	Assert(_ready);\n\
+	Assert(index >= 0 && index < kCount);\n\
 	return _colors[index];\n\
 }\n\
 \n\
diff --git a/Telegram/SourceFiles/core/utils.cpp b/Telegram/SourceFiles/core/utils.cpp
index 3869cb97a..f986174c4 100644
--- a/Telegram/SourceFiles/core/utils.cpp
+++ b/Telegram/SourceFiles/core/utils.cpp
@@ -181,22 +181,22 @@ namespace {
 	int _ffmpegLockManager(void **mutex, AVLockOp op) {
 		switch (op) {
 		case AV_LOCK_CREATE: {
-			t_assert(*mutex == 0);
+			Assert(*mutex == 0);
 			*mutex = reinterpret_cast<void*>(new QMutex());
 		} break;
 
 		case AV_LOCK_OBTAIN: {
-			t_assert(*mutex != 0);
+			Assert(*mutex != 0);
 			reinterpret_cast<QMutex*>(*mutex)->lock();
 		} break;
 
 		case AV_LOCK_RELEASE: {
-			t_assert(*mutex != 0);
+			Assert(*mutex != 0);
 			reinterpret_cast<QMutex*>(*mutex)->unlock();
 		}; break;
 
 		case AV_LOCK_DESTROY: {
-			t_assert(*mutex != 0);
+			Assert(*mutex != 0);
 			delete reinterpret_cast<QMutex*>(*mutex);
 			*mutex = 0;
 		} break;
@@ -662,7 +662,7 @@ char *hashMd5Hex(const int32 *hashmd5, void *dest) {
 }
 
 void memset_rand(void *data, uint32 len) {
-	t_assert(_sslInited);
+	Assert(_sslInited);
 	RAND_bytes((uchar*)data, len);
 }
 
diff --git a/Telegram/SourceFiles/core/utils.h b/Telegram/SourceFiles/core/utils.h
index 3c729513d..d0a5f6297 100644
--- a/Telegram/SourceFiles/core/utils.h
+++ b/Telegram/SourceFiles/core/utils.h
@@ -22,42 +22,6 @@ Copyright (c) 2014-2017 John Preston, https://desktop.telegram.org
 
 #include "core/basic_types.h"
 
-// Release build assertions.
-inline void t_noop() {
-}
-[[noreturn]] inline void t_assert_fail(const char *message, const char *file, int32 line) {
-	auto info = qsl("%1 %2:%3").arg(message).arg(file).arg(line);
-	LOG(("Assertion Failed! ") + info);
-	SignalHandlers::setCrashAnnotation("Assertion", info);
-
-	// Crash with access violation and generate crash report.
-	volatile int *t_assert_nullptr = nullptr;
-	*t_assert_nullptr = 0;
-
-	// Silent the possible failure to comply noreturn warning.
-	std::abort();
-}
-#define t_assert_full(condition, message, file, line) ((GSL_UNLIKELY(!(condition))) ? t_assert_fail(message, file, line) : t_noop())
-#define t_assert_c(condition, comment) t_assert_full(condition, "\"" #condition "\" (" comment ")", __FILE__, __LINE__)
-#define t_assert(condition) t_assert_full(condition, "\"" #condition "\"", __FILE__, __LINE__)
-
-// Declare our own versions of Expects() and Ensures().
-// Let them crash with reports and logging.
-#ifdef Expects
-#undef Expects
-#endif // Expects
-#define Expects(condition) t_assert_full(condition, "\"" #condition "\"", __FILE__, __LINE__)
-
-#ifdef Ensures
-#undef Ensures
-#endif // Ensures
-#define Ensures(condition) t_assert_full(condition, "\"" #condition "\"", __FILE__, __LINE__)
-
-#ifdef Unexpected
-#undef Unexpected
-#endif // Unexpected
-#define Unexpected(message) t_assert_fail("Unexpected: " message, __FILE__, __LINE__)
-
 // Define specializations for QByteArray for Qt 5.3.2, because
 // QByteArray in Qt 5.3.2 doesn't declare "pointer" subtype.
 #ifdef OS_MAC_OLD
@@ -667,7 +631,7 @@ public:
 		return data();
 	}
 	T &operator*() const {
-		t_assert(!isNull());
+		Assert(!isNull());
 		return *data();
 	}
 	explicit operator bool() const {
@@ -710,7 +674,7 @@ public:
 		return data();
 	}
 	T &operator*() const {
-		t_assert(!isNull());
+		Assert(!isNull());
 		return *data();
 	}
 	explicit operator bool() const {
diff --git a/Telegram/SourceFiles/data/data_abstract_structure.h b/Telegram/SourceFiles/data/data_abstract_structure.h
index e708b46d9..559aa0f6d 100644
--- a/Telegram/SourceFiles/data/data_abstract_structure.h
+++ b/Telegram/SourceFiles/data/data_abstract_structure.h
@@ -60,11 +60,11 @@ public:
 		}
 	}
 	Structure *operator->() {
-		t_assert(_p != nullptr);
+		Assert(_p != nullptr);
 		return static_cast<Structure*>(_p);
 	}
 	const Structure *operator->() const {
-		t_assert(_p != nullptr);
+		Assert(_p != nullptr);
 		return static_cast<const Structure*>(_p);
 	}
 	explicit operator bool() const {
diff --git a/Telegram/SourceFiles/dialogs/dialogs_indexed_list.cpp b/Telegram/SourceFiles/dialogs/dialogs_indexed_list.cpp
index 5d6b25748..1c84fe4a9 100644
--- a/Telegram/SourceFiles/dialogs/dialogs_indexed_list.cpp
+++ b/Telegram/SourceFiles/dialogs/dialogs_indexed_list.cpp
@@ -82,17 +82,17 @@ void IndexedList::moveToTop(PeerData *peer) {
 
 void IndexedList::movePinned(Row *row, int deltaSign) {
 	auto swapPinnedIndexWith = find(row);
-	t_assert(swapPinnedIndexWith != cend());
+	Assert(swapPinnedIndexWith != cend());
 	if (deltaSign > 0) {
 		++swapPinnedIndexWith;
 	} else {
-		t_assert(swapPinnedIndexWith != cbegin());
+		Assert(swapPinnedIndexWith != cbegin());
 		--swapPinnedIndexWith;
 	}
 	auto history1 = row->history();
 	auto history2 = (*swapPinnedIndexWith)->history();
-	t_assert(history1->isPinnedDialog());
-	t_assert(history2->isPinnedDialog());
+	Assert(history1->isPinnedDialog());
+	Assert(history2->isPinnedDialog());
 	auto index1 = history1->getPinnedIndex();
 	auto index2 = history2->getPinnedIndex();
 	history1->setPinnedIndex(index2);
@@ -100,7 +100,7 @@ void IndexedList::movePinned(Row *row, int deltaSign) {
 }
 
 void IndexedList::peerNameChanged(PeerData *peer, const PeerData::Names &oldNames, const PeerData::NameFirstChars &oldChars) {
-	t_assert(_sortMode != SortMode::Date);
+	Assert(_sortMode != SortMode::Date);
 	if (_sortMode == SortMode::Name) {
 		adjustByName(peer, oldNames, oldChars);
 	} else {
@@ -109,7 +109,7 @@ void IndexedList::peerNameChanged(PeerData *peer, const PeerData::Names &oldName
 }
 
 void IndexedList::peerNameChanged(Mode list, PeerData *peer, const PeerData::Names &oldNames, const PeerData::NameFirstChars &oldChars) {
-	t_assert(_sortMode == SortMode::Date);
+	Assert(_sortMode == SortMode::Date);
 	adjustNames(list, peer, oldNames, oldChars);
 }
 
diff --git a/Telegram/SourceFiles/dialogs/dialogs_inner_widget.cpp b/Telegram/SourceFiles/dialogs/dialogs_inner_widget.cpp
index 46ec6f733..504e5ddb8 100644
--- a/Telegram/SourceFiles/dialogs/dialogs_inner_widget.cpp
+++ b/Telegram/SourceFiles/dialogs/dialogs_inner_widget.cpp
@@ -729,7 +729,7 @@ int DialogsInner::updateReorderIndexGetCount() {
 	}
 
 	auto count = shownPinnedCount();
-	t_assert(index < count);
+	Assert(index < count);
 	if (count < 2) {
 		stopReorderPinned();
 		return 0;
diff --git a/Telegram/SourceFiles/dialogs/dialogs_layout.cpp b/Telegram/SourceFiles/dialogs/dialogs_layout.cpp
index 6fbcf400d..b1e7c32e3 100644
--- a/Telegram/SourceFiles/dialogs/dialogs_layout.cpp
+++ b/Telegram/SourceFiles/dialogs/dialogs_layout.cpp
@@ -203,7 +203,7 @@ const style::icon *ChatTypeIcon(PeerData *peer, bool active, bool selected) {
 }
 
 void paintUnreadBadge(Painter &p, const QRect &rect, const UnreadBadgeStyle &st) {
-	t_assert(rect.height() == st.size);
+	Assert(rect.height() == st.size);
 
 	int index = (st.muted ? 0x03 : 0x00) + (st.active ? 0x02 : (st.selected ? 0x01 : 0x00));
 	int size = st.size, sizehalf = size / 2;
@@ -211,7 +211,7 @@ void paintUnreadBadge(Painter &p, const QRect &rect, const UnreadBadgeStyle &st)
 	unreadBadgeStyle.createIfNull();
 	auto badgeData = unreadBadgeStyle->sizes;
 	if (st.sizeId > 0) {
-		t_assert(st.sizeId < UnreadBadgeSizesCount);
+		Assert(st.sizeId < UnreadBadgeSizesCount);
 		badgeData = &unreadBadgeStyle->sizes[st.sizeId];
 	}
 	auto bg = unreadBadgeStyle->bg[index];
diff --git a/Telegram/SourceFiles/dialogs/dialogs_widget.cpp b/Telegram/SourceFiles/dialogs/dialogs_widget.cpp
index f9d017ebc..641d59d9e 100644
--- a/Telegram/SourceFiles/dialogs/dialogs_widget.cpp
+++ b/Telegram/SourceFiles/dialogs/dialogs_widget.cpp
@@ -382,7 +382,7 @@ void DialogsWidget::dialogsReceived(const MTPmessages_Dialogs &dialogs, mtpReque
 			_dialogsFull = true;
 		}
 
-		t_assert(messagesList != nullptr);
+		Assert(messagesList != nullptr);
 		App::feedMsgs(*messagesList, NewMessageLast);
 
 		unreadCountsReceived(*dialogsList);
diff --git a/Telegram/SourceFiles/facades.cpp b/Telegram/SourceFiles/facades.cpp
index 76e008071..1ae2e5b6a 100644
--- a/Telegram/SourceFiles/facades.cpp
+++ b/Telegram/SourceFiles/facades.cpp
@@ -372,17 +372,17 @@ void unreadCounterUpdated() {
 } // namespace Notify
 
 #define DefineReadOnlyVar(Namespace, Type, Name) const Type &Name() { \
-	t_assert_full(Namespace##Data != 0, #Namespace "Data != nullptr in " #Namespace "::" #Name, __FILE__, __LINE__); \
+	AssertCustom(Namespace##Data != nullptr, #Namespace "Data != nullptr in " #Namespace "::" #Name); \
 	return Namespace##Data->Name; \
 }
 #define DefineRefVar(Namespace, Type, Name) DefineReadOnlyVar(Namespace, Type, Name) \
 Type &Ref##Name() { \
-	t_assert_full(Namespace##Data != 0, #Namespace "Data != nullptr in " #Namespace "::Ref" #Name, __FILE__, __LINE__); \
+	AssertCustom(Namespace##Data != nullptr, #Namespace "Data != nullptr in " #Namespace "::Ref" #Name); \
 	return Namespace##Data->Name; \
 }
 #define DefineVar(Namespace, Type, Name) DefineRefVar(Namespace, Type, Name) \
 void Set##Name(const Type &Name) { \
-	t_assert_full(Namespace##Data != 0, #Namespace "Data != nullptr in " #Namespace "::Set" #Name, __FILE__, __LINE__); \
+	AssertCustom(Namespace##Data != nullptr, #Namespace "Data != nullptr in " #Namespace "::Set" #Name); \
 	Namespace##Data->Name = Name; \
 }
 
diff --git a/Telegram/SourceFiles/history/history.cpp b/Telegram/SourceFiles/history/history.cpp
index 60053989f..a4a17b30b 100644
--- a/Telegram/SourceFiles/history/history.cpp
+++ b/Telegram/SourceFiles/history/history.cpp
@@ -722,7 +722,7 @@ void Histories::setIsPinned(History *history, bool isPinned) {
 					minIndexHistory = pinned;
 				}
 			}
-			t_assert(minIndexHistory != nullptr);
+			Assert(minIndexHistory != nullptr);
 			minIndexHistory->setPinnedDialog(false);
 		}
 	} else {
@@ -1543,7 +1543,7 @@ void History::addNewerSlice(const QVector<MTPMessage> &slice) {
 		}
 	}
 
-	t_assert(!isBuildingFrontBlock());
+	Assert(!isBuildingFrontBlock());
 	if (!slice.isEmpty()) {
 		bool atLeastOneAdded = false;
 		for (auto i = slice.cend(), e = slice.cbegin(); i != e;) {
@@ -1797,7 +1797,7 @@ void History::countScrollTopItem(int top) {
 				auto item = block->items[itemIndex];
 				itemTop = block->y() + item->y();
 				if (itemTop > top) {
-					t_assert(itemIndex > 0 || blockIndex > 0);
+					Assert(itemIndex > 0 || blockIndex > 0);
 					if (itemIndex > 0) {
 						scrollTopItem = block->items[itemIndex - 1];
 					} else {
@@ -1871,15 +1871,15 @@ HistoryItem *History::addNewInTheMiddle(HistoryItem *newItem, int32 blockIndex,
 }
 
 void History::startBuildingFrontBlock(int expectedItemsCount) {
-	t_assert(!isBuildingFrontBlock());
-	t_assert(expectedItemsCount > 0);
+	Assert(!isBuildingFrontBlock());
+	Assert(expectedItemsCount > 0);
 
 	_buildingFrontBlock.reset(new BuildingBlock());
 	_buildingFrontBlock->expectedItemsCount = expectedItemsCount;
 }
 
 HistoryBlock *History::finishBuildingFrontBlock() {
-	t_assert(isBuildingFrontBlock());
+	Assert(isBuildingFrontBlock());
 
 	// Some checks if there was some message history already
 	auto block = _buildingFrontBlock->block;
@@ -2184,7 +2184,7 @@ void History::clearOnDestroy() {
 }
 
 History::PositionInChatListChange History::adjustByPosInChatList(Dialogs::Mode list, Dialogs::IndexedList *indexed) {
-	t_assert(indexed != nullptr);
+	Assert(indexed != nullptr);
 	Dialogs::Row *lnk = mainChatListLink(list);
 	int32 movedFrom = lnk->pos();
 	indexed->adjustByPos(chatListLinks(list));
@@ -2197,7 +2197,7 @@ int History::posInChatList(Dialogs::Mode list) const {
 }
 
 Dialogs::Row *History::addToChatList(Dialogs::Mode list, Dialogs::IndexedList *indexed) {
-	t_assert(indexed != nullptr);
+	Assert(indexed != nullptr);
 	if (!inChatList(list)) {
 		chatListLinks(list) = indexed->addToEnd(this);
 		if (list == Dialogs::Mode::All && unreadCount()) {
@@ -2209,7 +2209,7 @@ Dialogs::Row *History::addToChatList(Dialogs::Mode list, Dialogs::IndexedList *i
 }
 
 void History::removeFromChatList(Dialogs::Mode list, Dialogs::IndexedList *indexed) {
-	t_assert(indexed != nullptr);
+	Assert(indexed != nullptr);
 	if (inChatList(list)) {
 		indexed->del(peer);
 		chatListLinks(list).clear();
@@ -2221,14 +2221,14 @@ void History::removeFromChatList(Dialogs::Mode list, Dialogs::IndexedList *index
 }
 
 void History::removeChatListEntryByLetter(Dialogs::Mode list, QChar letter) {
-	t_assert(letter != 0);
+	Assert(letter != 0);
 	if (inChatList(list)) {
 		chatListLinks(list).remove(letter);
 	}
 }
 
 void History::addChatListEntryByLetter(Dialogs::Mode list, QChar letter, Dialogs::Row *row) {
-	t_assert(letter != 0);
+	Assert(letter != 0);
 	if (inChatList(list)) {
 		chatListLinks(list).insert(letter, row);
 	}
diff --git a/Telegram/SourceFiles/history/history.h b/Telegram/SourceFiles/history/history.h
index 0c0b56aab..6ff1e1fea 100644
--- a/Telegram/SourceFiles/history/history.h
+++ b/Telegram/SourceFiles/history/history.h
@@ -571,7 +571,7 @@ private:
 	}
 	Dialogs::Row *mainChatListLink(Dialogs::Mode list) const {
 		auto it = chatListLinks(list).constFind(0);
-		t_assert(it != chatListLinks(list).cend());
+		Assert(it != chatListLinks(list).cend());
 		return it.value();
 	}
 	uint64 _sortKeyInChatList = 0; // like ((unixtime) << 32) | (incremented counter)
diff --git a/Telegram/SourceFiles/history/history_admin_log_inner.cpp b/Telegram/SourceFiles/history/history_admin_log_inner.cpp
index bd714042a..85bd2b2be 100644
--- a/Telegram/SourceFiles/history/history_admin_log_inner.cpp
+++ b/Telegram/SourceFiles/history/history_admin_log_inner.cpp
@@ -72,9 +72,9 @@ void InnerWidget::enumerateItems(Method method) {
 		--from;
 	}
 	if (TopToBottom) {
-		t_assert(itemTop(from->get()) + from->get()->height() > _visibleTop);
+		Assert(itemTop(from->get()) + from->get()->height() > _visibleTop);
 	} else {
-		t_assert(itemTop(from->get()) < _visibleBottom);
+		Assert(itemTop(from->get()) < _visibleBottom);
 	}
 
 	while (true) {
@@ -84,9 +84,9 @@ void InnerWidget::enumerateItems(Method method) {
 
 		// Binary search should've skipped all the items that are above / below the visible area.
 		if (TopToBottom) {
-			t_assert(itembottom > _visibleTop);
+			Assert(itembottom > _visibleTop);
 		} else {
-			t_assert(itemtop < _visibleBottom);
+			Assert(itemtop < _visibleBottom);
 		}
 
 		if (!method(item, itemtop, itembottom)) {
@@ -509,7 +509,7 @@ void InnerWidget::addEvents(Direction direction, const QVector<MTPChannelAdminLo
 	auto &addToItems = (direction == Direction::Up) ? _items : newItemsForDownDirection;
 	addToItems.reserve(oldItemsCount + events.size() * 2);
 	for_const (auto &event, events) {
-		t_assert(event.type() == mtpc_channelAdminLogEvent);
+		Assert(event.type() == mtpc_channelAdminLogEvent);
 		auto &data = event.c_channelAdminLogEvent();
 		if (_itemsByIds.find(data.vid.v) != _itemsByIds.cend()) {
 			continue;
diff --git a/Telegram/SourceFiles/history/history_inner_widget.cpp b/Telegram/SourceFiles/history/history_inner_widget.cpp
index 916e20b0d..dee46fee4 100644
--- a/Telegram/SourceFiles/history/history_inner_widget.cpp
+++ b/Telegram/SourceFiles/history/history_inner_widget.cpp
@@ -184,9 +184,9 @@ void HistoryInner::enumerateItemsInHistory(History *history, int historytop, Met
 
 			// Binary search should've skipped all the items that are above / below the visible area.
 			if (TopToBottom) {
-				t_assert(itembottom > _visibleAreaTop);
+				Assert(itembottom > _visibleAreaTop);
 			} else {
-				t_assert(itemtop < _visibleAreaBottom);
+				Assert(itemtop < _visibleAreaBottom);
 			}
 
 			if (!method(item, itemtop, itembottom)) {
@@ -1868,7 +1868,7 @@ void HistoryInner::adjustCurrent(int32 y) const {
 }
 
 void HistoryInner::adjustCurrent(int32 y, History *history) const {
-	t_assert(!history->isEmpty());
+	Assert(!history->isEmpty());
 	_curHistory = history;
 	if (_curBlock >= history->blocks.size()) {
 		_curBlock = history->blocks.size() - 1;
@@ -2282,11 +2282,11 @@ int HistoryInner::historyScrollTop() const {
 	auto htop = historyTop();
 	auto mtop = migratedTop();
 	if (htop >= 0 && _history->scrollTopItem) {
-		t_assert(!_history->scrollTopItem->detached());
+		Assert(!_history->scrollTopItem->detached());
 		return htop + _history->scrollTopItem->block()->y() + _history->scrollTopItem->y() + _history->scrollTopOffset;
 	}
 	if (mtop >= 0 && _migrated->scrollTopItem) {
-		t_assert(!_migrated->scrollTopItem->detached());
+		Assert(!_migrated->scrollTopItem->detached());
 		return mtop + _migrated->scrollTopItem->block()->y() + _migrated->scrollTopItem->y() + _migrated->scrollTopOffset;
 	}
 	return ScrollMax;
diff --git a/Telegram/SourceFiles/history/history_item.cpp b/Telegram/SourceFiles/history/history_item.cpp
index 0b9ad0eb0..5c0c5d1b5 100644
--- a/Telegram/SourceFiles/history/history_item.cpp
+++ b/Telegram/SourceFiles/history/history_item.cpp
@@ -227,8 +227,8 @@ int ReplyKeyboard::naturalHeight() const {
 }
 
 void ReplyKeyboard::paint(Painter &p, int outerWidth, const QRect &clip, TimeMs ms) const {
-	t_assert(_st != nullptr);
-	t_assert(_width > 0);
+	Assert(_st != nullptr);
+	Assert(_width > 0);
 
 	_st->startPaint(p);
 	for_const (auto &row, _rows) {
@@ -246,7 +246,7 @@ void ReplyKeyboard::paint(Painter &p, int outerWidth, const QRect &clip, TimeMs
 }
 
 ClickHandlerPtr ReplyKeyboard::getState(QPoint point) const {
-	t_assert(_width > 0);
+	Assert(_width > 0);
 
 	for_const (auto &row, _rows) {
 		for_const (auto &button, row) {
@@ -688,7 +688,7 @@ void HistoryItem::addLogEntryOriginal(WebPageId localId, const QString &label, c
 
 void HistoryItem::destroy() {
 	if (isLogEntry()) {
-		t_assert(detached());
+		Assert(detached());
 	} else {
 		// All this must be done for all items manually in History::clear(false)!
 		eraseFromOverview();
@@ -942,7 +942,7 @@ bool HistoryItem::hasDirectLink() const {
 QString HistoryItem::directLink() const {
 	if (hasDirectLink()) {
 		auto channel = _history->peer->asChannel();
-		t_assert(channel != nullptr);
+		Assert(channel != nullptr);
 		auto query = channel->username + '/' + QString::number(id);
 		if (!channel->isMegagroup()) {
 			if (auto media = getMedia()) {
@@ -996,7 +996,7 @@ bool HistoryItem::unread() const {
 
 void HistoryItem::destroyUnreadBar() {
 	if (Has<HistoryMessageUnreadBar>()) {
-		t_assert(!isLogEntry());
+		Assert(!isLogEntry());
 
 		RemoveComponents(HistoryMessageUnreadBar::Bit());
 		setPendingInitDimensions();
diff --git a/Telegram/SourceFiles/history/history_item.h b/Telegram/SourceFiles/history/history_item.h
index ec4550a06..6e058fffe 100644
--- a/Telegram/SourceFiles/history/history_item.h
+++ b/Telegram/SourceFiles/history/history_item.h
@@ -955,7 +955,7 @@ protected:
 				return _block->items.at(_indexInBlock - 1);
 			}
 			if (auto previous = _block->previousBlock()) {
-				t_assert(!previous->items.isEmpty());
+				Assert(!previous->items.isEmpty());
 				return previous->items.back();
 			}
 		}
@@ -967,7 +967,7 @@ protected:
 				return _block->items.at(_indexInBlock + 1);
 			}
 			if (auto next = _block->nextBlock()) {
-				t_assert(!next->items.isEmpty());
+				Assert(!next->items.isEmpty());
 				return next->items.front();
 			}
 		}
diff --git a/Telegram/SourceFiles/history/history_service.cpp b/Telegram/SourceFiles/history/history_service.cpp
index ef35648d2..7f78d22a4 100644
--- a/Telegram/SourceFiles/history/history_service.cpp
+++ b/Telegram/SourceFiles/history/history_service.cpp
@@ -229,7 +229,7 @@ void HistoryService::setSelfDestruct(HistoryServiceSelfDestruct::Type type, int
 
 bool HistoryService::updateDependent(bool force) {
 	auto dependent = GetDependentData();
-	t_assert(dependent != nullptr);
+	Assert(dependent != nullptr);
 
 	if (!force) {
 		if (!dependent->msgId || dependent->msg) {
@@ -626,7 +626,7 @@ void HistoryService::createFromMtp(const MTPDmessage &message) {
 	case mtpc_messageMediaPhoto: {
 		if (message.is_media_unread()) {
 			auto &photo = message.vmedia.c_messageMediaPhoto();
-			t_assert(photo.has_ttl_seconds());
+			Assert(photo.has_ttl_seconds());
 			setSelfDestruct(HistoryServiceSelfDestruct::Type::Photo, photo.vttl_seconds.v);
 			if (out()) {
 				setServiceText({ lang(lng_ttl_photo_sent) });
@@ -643,7 +643,7 @@ void HistoryService::createFromMtp(const MTPDmessage &message) {
 	case mtpc_messageMediaDocument: {
 		if (message.is_media_unread()) {
 			auto &document = message.vmedia.c_messageMediaDocument();
-			t_assert(document.has_ttl_seconds());
+			Assert(document.has_ttl_seconds());
 			setSelfDestruct(HistoryServiceSelfDestruct::Type::Video, document.vttl_seconds.v);
 			if (out()) {
 				setServiceText({ lang(lng_ttl_video_sent) });
diff --git a/Telegram/SourceFiles/history/history_widget.cpp b/Telegram/SourceFiles/history/history_widget.cpp
index fea788a9e..2293c3207 100644
--- a/Telegram/SourceFiles/history/history_widget.cpp
+++ b/Telegram/SourceFiles/history/history_widget.cpp
@@ -957,7 +957,7 @@ void HistoryWidget::highlightMessage(HistoryItem *context) {
 
 int HistoryWidget::itemTopForHighlight(not_null<HistoryItem*> item) const {
 	auto itemTop = _list->itemTop(item);
-	t_assert(itemTop >= 0);
+	Assert(itemTop >= 0);
 
 	auto heightLeft = (_scroll->height() - item->height());
 	if (heightLeft <= 0) {
@@ -1084,7 +1084,7 @@ void HistoryWidget::setReportSpamStatus(DBIPeerReportSpamStatus status) {
 	}
 	_reportSpamStatus = status;
 	if (_reportSpamStatus == dbiprsShowButton || _reportSpamStatus == dbiprsReportSent) {
-		t_assert(_peer != nullptr);
+		Assert(_peer != nullptr);
 		_reportSpamPanel.create(this);
 		connect(_reportSpamPanel, SIGNAL(reportClicked()), this, SLOT(onReportSpamClicked()));
 		connect(_reportSpamPanel, SIGNAL(hideClicked()), this, SLOT(onReportSpamHide()));
@@ -3890,7 +3890,7 @@ void HistoryWidget::toggleTabbedSelectorMode() {
 		recountChatWidth();
 		updateControlsGeometry();
 	} else {
-		t_assert(_tabbedPanel != nullptr);
+		Assert(_tabbedPanel != nullptr);
 		_tabbedPanel->toggleAnimated();
 	}
 }
@@ -4319,7 +4319,7 @@ void HistoryWidget::uploadFiles(const QStringList &files, SendMediaType type) {
 }
 
 void HistoryWidget::uploadFilesAfterConfirmation(const QStringList &files, const QByteArray &content, const QImage &image, std::unique_ptr<FileLoadTask::MediaInformation> information, SendMediaType type, QString caption) {
-	t_assert(canWriteMessage());
+	Assert(canWriteMessage());
 
 	auto to = FileLoadTo(_peer->id, _silent->checked(), replyToId());
 	if (files.size() > 1 && !caption.isEmpty()) {
@@ -5167,7 +5167,7 @@ void HistoryWidget::mousePressEvent(QMouseEvent *e) {
 			Ui::showPeerHistory(_peer, _editMsgId ? _editMsgId : replyToId());
 		}
 	} else if (_inPinnedMsg) {
-		t_assert(_pinnedBar != nullptr);
+		Assert(_pinnedBar != nullptr);
 		Ui::showPeerHistory(_peer, _pinnedBar->msgId);
 	}
 }
@@ -5332,7 +5332,7 @@ void HistoryWidget::updatePinnedBar(bool force) {
 		}
 	}
 
-	t_assert(_history != nullptr);
+	Assert(_history != nullptr);
 	if (!_pinnedBar->msg) {
 		_pinnedBar->msg = App::histItemById(_history->channelId(), _pinnedBar->msgId);
 	}
diff --git a/Telegram/SourceFiles/inline_bots/inline_bot_send_data.h b/Telegram/SourceFiles/inline_bots/inline_bot_send_data.h
index 07113b9ce..4f9b4d493 100644
--- a/Telegram/SourceFiles/inline_bots/inline_bot_send_data.h
+++ b/Telegram/SourceFiles/inline_bots/inline_bot_send_data.h
@@ -114,7 +114,7 @@ public:
 		return true;
 	}
 	bool getLocationCoords(LocationCoords *outLocation) const override {
-		t_assert(outLocation != nullptr);
+		Assert(outLocation != nullptr);
 		*outLocation = _location;
 		return true;
 	}
@@ -146,7 +146,7 @@ public:
 		return true;
 	}
 	bool getLocationCoords(LocationCoords *outLocation) const override {
-		t_assert(outLocation != nullptr);
+		Assert(outLocation != nullptr);
 		*outLocation = _location;
 		return true;
 	}
diff --git a/Telegram/SourceFiles/inline_bots/inline_results_widget.cpp b/Telegram/SourceFiles/inline_bots/inline_results_widget.cpp
index e1435b737..a9548b8f0 100644
--- a/Telegram/SourceFiles/inline_bots/inline_results_widget.cpp
+++ b/Telegram/SourceFiles/inline_bots/inline_results_widget.cpp
@@ -262,7 +262,7 @@ void Inner::enterFromChildEvent(QEvent *e, QWidget *child) {
 void Inner::clearSelection() {
 	if (_selected >= 0) {
 		int srow = _selected / MatrixRowShift, scol = _selected % MatrixRowShift;
-		t_assert(srow >= 0 && srow < _rows.size() && scol >= 0 && scol < _rows.at(srow).items.size());
+		Assert(srow >= 0 && srow < _rows.size() && scol >= 0 && scol < _rows.at(srow).items.size());
 		ClickHandler::clearActive(_rows.at(srow).items.at(scol));
 		setCursor(style::cur_default);
 	}
@@ -375,7 +375,7 @@ void Inner::deleteUnusedInlineLayouts() {
 
 Inner::Row &Inner::layoutInlineRow(Row &row, int32 sumWidth) {
 	auto count = int(row.items.size());
-	t_assert(count <= kInlineItemsMaxPerRow);
+	Assert(count <= kInlineItemsMaxPerRow);
 
 	// enumerate items in the order of growing maxWidth()
 	// for that sort item indices by maxWidth()
@@ -470,7 +470,7 @@ int Inner::refreshInlineRows(PeerData *queryPeer, UserData *bot, const CacheEntr
 
 	clearSelection();
 
-	t_assert(_inlineBot != 0);
+	Assert(_inlineBot != 0);
 
 	auto count = int(entry->results.size());
 	auto from = validateExistingInlineRows(entry->results);
@@ -588,7 +588,7 @@ bool Inner::inlineItemVisible(const ItemBase *layout) {
 	}
 
 	int row = position / MatrixRowShift, col = position % MatrixRowShift;
-	t_assert((row < _rows.size()) && (col < _rows[row].items.size()));
+	Assert((row < _rows.size()) && (col < _rows[row].items.size()));
 
 	auto &inlineItems = _rows[row].items;
 	int top = st::stickerPanPadding;
@@ -652,12 +652,12 @@ void Inner::updateSelected() {
 	int scol = (_selected >= 0) ? (_selected % MatrixRowShift) : -1;
 	if (_selected != sel) {
 		if (srow >= 0 && scol >= 0) {
-			t_assert(srow >= 0 && srow < _rows.size() && scol >= 0 && scol < _rows.at(srow).items.size());
+			Assert(srow >= 0 && srow < _rows.size() && scol >= 0 && scol < _rows.at(srow).items.size());
 			_rows[srow].items[scol]->update();
 		}
 		_selected = sel;
 		if (row >= 0 && col >= 0) {
-			t_assert(row >= 0 && row < _rows.size() && col >= 0 && col < _rows.at(row).items.size());
+			Assert(row >= 0 && row < _rows.size() && col >= 0 && col < _rows.at(row).items.size());
 			_rows[row].items[col]->update();
 		}
 		if (_previewShown && _selected >= 0 && _pressed != _selected) {
@@ -811,7 +811,7 @@ void Widget::paintEvent(QPaintEvent *e) {
 	}
 
 	if (showAnimating) {
-		t_assert(_showAnimation != nullptr);
+		Assert(_showAnimation != nullptr);
 		if (auto opacity = _a_opacity.current(_hiding ? 0. : 1.)) {
 			_showAnimation->paintFrame(p, 0, 0, width(), _a_show.current(1.), opacity);
 		}
diff --git a/Telegram/SourceFiles/intro/introwidget.cpp b/Telegram/SourceFiles/intro/introwidget.cpp
index dddb498f6..7f10f232e 100644
--- a/Telegram/SourceFiles/intro/introwidget.cpp
+++ b/Telegram/SourceFiles/intro/introwidget.cpp
@@ -163,7 +163,7 @@ void Widget::setInnerFocus() {
 void Widget::historyMove(Direction direction) {
 	if (getStep()->animating()) return;
 
-	t_assert(_stepHistory.size() > 1);
+	Assert(_stepHistory.size() > 1);
 
 	auto wasStep = getStep((direction == Direction::Back) ? 0 : 1);
 	if (direction == Direction::Back) {
@@ -614,9 +614,9 @@ void Widget::Step::prepareCoverMask() {
 	auto maskHeight = st::introCoverHeight * cIntRetinaFactor();
 	auto mask = QImage(maskWidth, maskHeight, QImage::Format_ARGB32_Premultiplied);
 	auto maskInts = reinterpret_cast<uint32*>(mask.bits());
-	t_assert(mask.depth() == (sizeof(uint32) << 3));
+	Assert(mask.depth() == (sizeof(uint32) << 3));
 	auto maskIntsPerLineAdded = (mask.bytesPerLine() >> 2) - maskWidth;
-	t_assert(maskIntsPerLineAdded >= 0);
+	Assert(maskIntsPerLineAdded >= 0);
 	auto realHeight = static_cast<float64>(maskHeight - 1);
 	for (auto y = 0; y != maskHeight; ++y) {
 		auto color = anim::color(st::introCoverTopBg, st::introCoverBottomBg, y / realHeight);
diff --git a/Telegram/SourceFiles/intro/introwidget.h b/Telegram/SourceFiles/intro/introwidget.h
index 6cc3f2372..91886e64c 100644
--- a/Telegram/SourceFiles/intro/introwidget.h
+++ b/Telegram/SourceFiles/intro/introwidget.h
@@ -232,7 +232,7 @@ private:
 	void resetAccount();
 
 	Step *getStep(int skip = 0) {
-		t_assert(_stepHistory.size() + skip > 0);
+		Assert(_stepHistory.size() + skip > 0);
 		return _stepHistory.at(_stepHistory.size() - skip - 1);
 	}
 	void historyMove(Direction direction);
diff --git a/Telegram/SourceFiles/lang/lang_cloud_manager.cpp b/Telegram/SourceFiles/lang/lang_cloud_manager.cpp
index 5e1b3605d..a721de650 100644
--- a/Telegram/SourceFiles/lang/lang_cloud_manager.cpp
+++ b/Telegram/SourceFiles/lang/lang_cloud_manager.cpp
@@ -116,7 +116,7 @@ void CloudManager::requestLanguageList() {
 	_languagesRequestId = request(MTPlangpack_GetLanguages()).done([this](const MTPVector<MTPLangPackLanguage> &result) {
 		auto languages = Languages();
 		for_const (auto &langData, result.v) {
-			t_assert(langData.type() == mtpc_langPackLanguage);
+			Assert(langData.type() == mtpc_langPackLanguage);
 			auto &language = langData.c_langPackLanguage();
 			languages.push_back({ qs(language.vlang_code), qs(language.vname), qs(language.vnative_name) });
 		}
@@ -312,7 +312,7 @@ void CloudManager::changeIdAndReInitConnection(const QString &id) {
 
 CloudManager &CurrentCloudManager() {
 	auto result = Messenger::Instance().langCloudManager();
-	t_assert(result != nullptr);
+	Assert(result != nullptr);
 	return *result;
 }
 
diff --git a/Telegram/SourceFiles/logs.cpp b/Telegram/SourceFiles/logs.cpp
index 2b51ec450..1d6bb3159 100644
--- a/Telegram/SourceFiles/logs.cpp
+++ b/Telegram/SourceFiles/logs.cpp
@@ -161,7 +161,7 @@ private:
 		QFlags<QIODevice::OpenModeFlag> mode = QIODevice::WriteOnly | QIODevice::Text;
 		if (type == LogDataMain) { // we can call LOG() in LogDataMain reopen - mutex not locked
 			if (postfix.isEmpty()) { // instance checked, need to move to log.txt
-				t_assert(!files[type]->fileName().isEmpty()); // one of log_startXX.txt should've been opened already
+				Assert(!files[type]->fileName().isEmpty()); // one of log_startXX.txt should've been opened already
 
 				QSharedPointer<QFile> to(new QFile(_logsFilePath(type, postfix)));
 				if (to->exists() && !to->remove()) {
@@ -301,7 +301,7 @@ namespace SignalHandlers {
 namespace Logs {
 
 	void start() {
-		t_assert(LogsData == 0);
+		Assert(LogsData == 0);
 
 		if (!Sandbox::CheckBetaVersionDir()) {
 			return;
@@ -386,7 +386,7 @@ namespace Logs {
 		}
 
 		if (LogsInMemory) {
-			t_assert(LogsInMemory != DeletedLogsInMemory);
+			Assert(LogsInMemory != DeletedLogsInMemory);
 			LogsInMemoryList list = *LogsInMemory;
 			for (LogsInMemoryList::const_iterator i = list.cbegin(), e = list.cend(); i != e; ++i) {
 				if (i->first == LogDataMain) {
@@ -429,7 +429,7 @@ namespace Logs {
 		}
 
 		if (LogsInMemory) {
-			t_assert(LogsInMemory != DeletedLogsInMemory);
+			Assert(LogsInMemory != DeletedLogsInMemory);
 			LogsInMemoryList list = *LogsInMemory;
 			for (LogsInMemoryList::const_iterator i = list.cbegin(), e = list.cend(); i != e; ++i) {
 				if (i->first != LogDataMain) {
@@ -438,7 +438,7 @@ namespace Logs {
 			}
 		}
 		if (LogsInMemory) {
-			t_assert(LogsInMemory != DeletedLogsInMemory);
+			Assert(LogsInMemory != DeletedLogsInMemory);
 			delete LogsInMemory;
 		}
 		LogsInMemory = DeletedLogsInMemory;
@@ -450,7 +450,7 @@ namespace Logs {
 
 	void multipleInstances() {
 		if (LogsInMemory) {
-			t_assert(LogsInMemory != DeletedLogsInMemory);
+			Assert(LogsInMemory != DeletedLogsInMemory);
 			delete LogsInMemory;
 		}
 		LogsInMemory = DeletedLogsInMemory;
diff --git a/Telegram/SourceFiles/logs.h b/Telegram/SourceFiles/logs.h
index 01c758b34..3e70555b3 100644
--- a/Telegram/SourceFiles/logs.h
+++ b/Telegram/SourceFiles/logs.h
@@ -117,3 +117,15 @@ namespace SignalHandlers {
 	}
 
 }
+
+namespace base {
+namespace assertion {
+
+inline void log(const char *message, const char *file, int line) {
+	auto info = QStringLiteral("%1 %2:%3").arg(message).arg(file).arg(line);
+	LOG(("Assertion Failed! ") + info);
+	SignalHandlers::setCrashAnnotation("Assertion", info);
+}
+
+} // namespace assertion
+} // namespace base
diff --git a/Telegram/SourceFiles/mainwidget.cpp b/Telegram/SourceFiles/mainwidget.cpp
index 59b046b94..09ae9be1f 100644
--- a/Telegram/SourceFiles/mainwidget.cpp
+++ b/Telegram/SourceFiles/mainwidget.cpp
@@ -381,7 +381,7 @@ void MainWidget::removeFloatPlayer(not_null<Float*> instance) {
 	auto i = std::find_if(_playerFloats.begin(), _playerFloats.end(), [instance](auto &item) {
 		return (item.get() == instance);
 	});
-	t_assert(i != _playerFloats.end());
+	Assert(i != _playerFloats.end());
 	_playerFloats.erase(i);
 
 	// ~QWidget() can call HistoryInner::enterEvent() which can
@@ -1118,7 +1118,7 @@ void MainWidget::deleteAndExit(ChatData *chat) {
 }
 
 void MainWidget::deleteAllFromUser(ChannelData *channel, UserData *from) {
-	t_assert(channel != nullptr && from != nullptr);
+	Assert(channel != nullptr && from != nullptr);
 
 	QVector<MsgId> toDestroy;
 	if (auto history = App::historyLoaded(channel->id)) {
@@ -5189,7 +5189,7 @@ void MainWidget::feedUpdate(const MTPUpdate &update) {
 				App::histories().clearPinned();
 				for (auto i = order.size(); i != 0;) {
 					auto history = App::historyLoaded(peerFromMTP(order[--i]));
-					t_assert(history != nullptr);
+					Assert(history != nullptr);
 					history->setPinnedDialog(true);
 				}
 			} else {
diff --git a/Telegram/SourceFiles/mainwindow.cpp b/Telegram/SourceFiles/mainwindow.cpp
index c544ca6b0..92ec36807 100644
--- a/Telegram/SourceFiles/mainwindow.cpp
+++ b/Telegram/SourceFiles/mainwindow.cpp
@@ -213,7 +213,7 @@ void MainWindow::clearPasscode() {
 	if (_intro) {
 		_intro->showAnimated(bg, true);
 	} else {
-		t_assert(_main != nullptr);
+		Assert(_main != nullptr);
 		_main->showAnimated(bg, true);
 		Messenger::Instance().checkStartUrl();
 	}
@@ -299,7 +299,7 @@ void MainWindow::setupMain(const MTPUser *self) {
 
 	clearWidgets();
 
-	t_assert(AuthSession::Exists());
+	Assert(AuthSession::Exists());
 
 	_main.create(bodyWidget(), controller());
 	_main->show();
diff --git a/Telegram/SourceFiles/media/media_audio.cpp b/Telegram/SourceFiles/media/media_audio.cpp
index 3bc32c458..b0a1ade1e 100644
--- a/Telegram/SourceFiles/media/media_audio.cpp
+++ b/Telegram/SourceFiles/media/media_audio.cpp
@@ -79,7 +79,7 @@ bool PlaybackErrorHappened() {
 void EnumeratePlaybackDevices() {
 	auto deviceNames = QStringList();
 	auto devices = alcGetString(nullptr, ALC_DEVICE_SPECIFIER);
-	t_assert(devices != nullptr);
+	Assert(devices != nullptr);
 	while (*devices != 0) {
 		auto deviceName8Bit = QByteArray(devices);
 		auto deviceName = QString::fromLocal8Bit(deviceName8Bit);
@@ -98,7 +98,7 @@ void EnumeratePlaybackDevices() {
 void EnumerateCaptureDevices() {
 	auto deviceNames = QStringList();
 	auto devices = alcGetString(nullptr, ALC_CAPTURE_DEVICE_SPECIFIER);
-	t_assert(devices != nullptr);
+	Assert(devices != nullptr);
 	while (*devices != 0) {
 		auto deviceName8Bit = QByteArray(devices);
 		auto deviceName = QString::fromLocal8Bit(deviceName8Bit);
@@ -174,7 +174,7 @@ void ClosePlaybackDevice() {
 
   // Thread: Main.
 void Start() {
-	t_assert(AudioDevice == nullptr);
+	Assert(AudioDevice == nullptr);
 
 	qRegisterMetaType<AudioMsgId>();
 	qRegisterMetaType<VoiceWaveform>();
diff --git a/Telegram/SourceFiles/media/media_audio_capture.cpp b/Telegram/SourceFiles/media/media_audio_capture.cpp
index f9efd27c9..5ac456e58 100644
--- a/Telegram/SourceFiles/media/media_audio_capture.cpp
+++ b/Telegram/SourceFiles/media/media_audio_capture.cpp
@@ -50,7 +50,7 @@ bool ErrorHappened(ALCdevice *device) {
 } // namespace
 
 void Start() {
-	t_assert(CaptureInstance == nullptr);
+	Assert(CaptureInstance == nullptr);
 	CaptureInstance = new Instance();
 	instance()->check();
 }
diff --git a/Telegram/SourceFiles/media/media_audio_loader.cpp b/Telegram/SourceFiles/media/media_audio_loader.cpp
index 97b5c7f77..c63435f8c 100644
--- a/Telegram/SourceFiles/media/media_audio_loader.cpp
+++ b/Telegram/SourceFiles/media/media_audio_loader.cpp
@@ -38,18 +38,18 @@ bool AudioPlayerLoader::check(const FileLocation &file, const QByteArray &data)
 }
 
 void AudioPlayerLoader::saveDecodedSamples(QByteArray *samples, int64 *samplesCount) {
-	t_assert(_savedSamplesCount == 0);
-	t_assert(_savedSamples.isEmpty());
-	t_assert(!_holdsSavedSamples);
+	Assert(_savedSamplesCount == 0);
+	Assert(_savedSamples.isEmpty());
+	Assert(!_holdsSavedSamples);
 	samples->swap(_savedSamples);
 	std::swap(*samplesCount, _savedSamplesCount);
 	_holdsSavedSamples = true;
 }
 
 void AudioPlayerLoader::takeSavedDecodedSamples(QByteArray *samples, int64 *samplesCount) {
-	t_assert(*samplesCount == 0);
-	t_assert(samples->isEmpty());
-	t_assert(_holdsSavedSamples);
+	Assert(*samplesCount == 0);
+	Assert(samples->isEmpty());
+	Assert(_holdsSavedSamples);
 	samples->swap(_savedSamples);
 	std::swap(*samplesCount, _savedSamplesCount);
 	_holdsSavedSamples = false;
diff --git a/Telegram/SourceFiles/media/media_clip_qtgif.cpp b/Telegram/SourceFiles/media/media_clip_qtgif.cpp
index 722abff6e..890d55d36 100644
--- a/Telegram/SourceFiles/media/media_clip_qtgif.cpp
+++ b/Telegram/SourceFiles/media/media_clip_qtgif.cpp
@@ -71,7 +71,7 @@ ReaderImplementation::ReadResult QtGifReaderImplementation::readNextFrame() {
 }
 
 bool QtGifReaderImplementation::renderFrame(QImage &to, bool &hasAlpha, const QSize &size) {
-	t_assert(!_frame.isNull());
+	Assert(!_frame.isNull());
 	if (size.isEmpty() || size == _frame.size()) {
 		int32 w = _frame.width(), h = _frame.height();
 		if (to.width() == w && to.height() == h && to.format() == _frame.format()) {
diff --git a/Telegram/SourceFiles/media/media_clip_reader.cpp b/Telegram/SourceFiles/media/media_clip_reader.cpp
index 960aece0d..7c38913be 100644
--- a/Telegram/SourceFiles/media/media_clip_reader.cpp
+++ b/Telegram/SourceFiles/media/media_clip_reader.cpp
@@ -229,7 +229,7 @@ QPixmap Reader::current(int32 framew, int32 frameh, int32 outerw, int32 outerh,
 	Expects(outerh > 0);
 
 	auto frame = frameToShow();
-	t_assert(frame != nullptr);
+	Assert(frame != nullptr);
 
 	auto shouldBePaused = !ms;
 	if (!shouldBePaused) {
@@ -281,7 +281,7 @@ QPixmap Reader::current() {
 	Expects(_mode == Mode::Video);
 
 	auto frame = frameToShow();
-	t_assert(frame != nullptr);
+	Assert(frame != nullptr);
 
 	frame->displayed.storeRelease(1);
 	moveToNextShow();
@@ -473,7 +473,7 @@ public:
 	}
 
 	bool renderFrame() {
-		t_assert(frame() != 0 && _request.valid());
+		Assert(frame() != 0 && _request.valid());
 		if (!_implementation->renderFrame(frame()->original, frame()->alpha, QSize(_request.framew, _request.frameh))) {
 			return false;
 		}
@@ -699,7 +699,7 @@ bool Manager::handleProcessResult(ReaderPrivate *reader, ProcessResult result, T
 	if (!reader->_autoPausedGif && reader->_mode == Reader::Mode::Gif && result == ProcessResult::Repaint) {
 		int32 ishowing, iprevious;
 		auto showing = it.key()->frameToShow(&ishowing), previous = it.key()->frameToWriteNext(false, &iprevious);
-		t_assert(previous != nullptr && showing != nullptr && ishowing >= 0 && iprevious >= 0);
+		Assert(previous != nullptr && showing != nullptr && ishowing >= 0 && iprevious >= 0);
 		if (reader->_frames[ishowing].when > 0 && showing->displayed.loadAcquire() <= 0) { // current frame was not shown
 			if (reader->_frames[ishowing].when + WaitBeforeGifPause < ms || (reader->_frames[iprevious].when && previous->displayed.loadAcquire() <= 0)) {
 				reader->_autoPausedGif = true;
@@ -709,7 +709,7 @@ bool Manager::handleProcessResult(ReaderPrivate *reader, ProcessResult result, T
 		}
 	}
 	if (result == ProcessResult::Started || result == ProcessResult::CopyFrame) {
-		t_assert(reader->_frame >= 0);
+		Assert(reader->_frame >= 0);
 		auto frame = it.key()->_frames + reader->_frame;
 		frame->clear();
 		frame->pix = reader->frame()->pix;
@@ -754,7 +754,7 @@ Manager::ResultHandleState Manager::handleResult(ReaderPrivate *reader, ProcessR
 				if (frame) {
 					frame->clear();
 				} else {
-					t_assert(!reader->_request.valid());
+					Assert(!reader->_request.valid());
 				}
 				reader->_frame = index;
 			}
diff --git a/Telegram/SourceFiles/media/player/media_player_button.cpp b/Telegram/SourceFiles/media/player/media_player_button.cpp
index 118a563ea..fb944e072 100644
--- a/Telegram/SourceFiles/media/player/media_player_button.cpp
+++ b/Telegram/SourceFiles/media/player/media_player_button.cpp
@@ -66,16 +66,16 @@ void PlayButtonLayout::paint(Painter &p, const QBrush &brush) {
 		}
 		if (backward) progress = 1. - progress;
 
-		t_assert(from != to);
+		Assert(from != to);
 		if (from == State::Play) {
 			if (to == State::Pause) {
 				paintPlayToPause(p, brush, progress);
 			} else {
-				t_assert(to == State::Cancel);
+				Assert(to == State::Cancel);
 				paintPlayToCancel(p, brush, progress);
 			}
 		} else {
-			t_assert(from == State::Pause && to == State::Cancel);
+			Assert(from == State::Pause && to == State::Cancel);
 			paintPauseToCancel(p, brush, progress);
 		}
 	} else {
diff --git a/Telegram/SourceFiles/media/player/media_player_float.cpp b/Telegram/SourceFiles/media/player/media_player_float.cpp
index 1836df143..ab2657df5 100644
--- a/Telegram/SourceFiles/media/player/media_player_float.cpp
+++ b/Telegram/SourceFiles/media/player/media_player_float.cpp
@@ -35,11 +35,11 @@ Float::Float(QWidget *parent, HistoryItem *item, base::lambda<void(bool visible)
 , _toggleCallback(std::move(toggleCallback))
 , _draggedCallback(std::move(draggedCallback)) {
 	auto media = _item->getMedia();
-	t_assert(media != nullptr);
+	Assert(media != nullptr);
 
 	auto document = media->getDocument();
-	t_assert(document != nullptr);
-	t_assert(document->isRoundVideo());
+	Assert(document != nullptr);
+	Assert(document->isRoundVideo());
 
 	auto margin = st::mediaPlayerFloatMargin;
 	auto size = 2 * margin + st::mediaPlayerFloatSize;
diff --git a/Telegram/SourceFiles/mediaview.cpp b/Telegram/SourceFiles/mediaview.cpp
index 60ba3d41d..ff4e434a0 100644
--- a/Telegram/SourceFiles/mediaview.cpp
+++ b/Telegram/SourceFiles/mediaview.cpp
@@ -1478,7 +1478,7 @@ void MediaView::createClipReader() {
 }
 
 void MediaView::initThemePreview() {
-	t_assert(_doc && _doc->isTheme());
+	Assert(_doc && _doc->isTheme());
 
 	auto &location = _doc->location();
 	if (!location.isEmpty() && location.accessEnable()) {
@@ -1541,7 +1541,7 @@ void MediaView::createClipController() {
 }
 
 void MediaView::setClipControllerGeometry() {
-	t_assert(_clipController != nullptr);
+	Assert(_clipController != nullptr);
 
 	int controllerBottom = _captionRect.isEmpty() ? height() : _captionRect.y();
 	_clipController->setGeometry(
diff --git a/Telegram/SourceFiles/messenger.cpp b/Telegram/SourceFiles/messenger.cpp
index e32ad2bbd..f4d0f8d2f 100644
--- a/Telegram/SourceFiles/messenger.cpp
+++ b/Telegram/SourceFiles/messenger.cpp
@@ -411,7 +411,7 @@ void Messenger::startMtp() {
 		if (_authSession) {
 			_authSession->data().copyFrom(_private->storedAuthSession->data);
 			if (auto window = App::wnd()) {
-				t_assert(window->controller() != nullptr);
+				Assert(window->controller() != nullptr);
 				window->controller()->dialogsWidthRatio().set(_private->storedAuthSession->dialogsWidthRatio);
 			}
 		}
@@ -444,7 +444,7 @@ void Messenger::onAllKeysDestroyed() {
 }
 
 void Messenger::suggestMainDcId(MTP::DcId mainDcId) {
-	t_assert(_mtproto != nullptr);
+	Assert(_mtproto != nullptr);
 
 	_mtproto->suggestMainDcId(mainDcId);
 	if (_private->mtpConfig.mainDcId != MTP::Instance::Config::kNotSetMainDc) {
@@ -453,7 +453,7 @@ void Messenger::suggestMainDcId(MTP::DcId mainDcId) {
 }
 
 void Messenger::destroyStaleAuthorizationKeys() {
-	t_assert(_mtproto != nullptr);
+	Assert(_mtproto != nullptr);
 
 	auto keys = _mtproto->getKeysForWrite();
 	for (auto &key : keys) {
@@ -984,7 +984,7 @@ void Messenger::loggedOut() {
 
 QPoint Messenger::getPointForCallPanelCenter() const {
 	if (auto activeWindow = getActiveWindow()) {
-		t_assert(activeWindow->windowHandle() != nullptr);
+		Assert(activeWindow->windowHandle() != nullptr);
 		if (activeWindow->isActive()) {
 			return activeWindow->geometry().center();
 		}
diff --git a/Telegram/SourceFiles/messenger.h b/Telegram/SourceFiles/messenger.h
index be2173425..b0af99ae1 100644
--- a/Telegram/SourceFiles/messenger.h
+++ b/Telegram/SourceFiles/messenger.h
@@ -99,7 +99,7 @@ public:
 	static Messenger *InstancePointer();
 	static Messenger &Instance() {
 		auto result = InstancePointer();
-		t_assert(result != nullptr);
+		Assert(result != nullptr);
 		return *result;
 	}
 
diff --git a/Telegram/SourceFiles/mtproto/auth_key.h b/Telegram/SourceFiles/mtproto/auth_key.h
index 823eefde3..1b46c562d 100644
--- a/Telegram/SourceFiles/mtproto/auth_key.h
+++ b/Telegram/SourceFiles/mtproto/auth_key.h
@@ -75,7 +75,7 @@ public:
 
 	static void FillData(Data &authKey, base::const_byte_span computedAuthKey) {
 		auto computedAuthKeySize = computedAuthKey.size();
-		t_assert(computedAuthKeySize <= kSize);
+		Assert(computedAuthKeySize <= kSize);
 		auto authKeyBytes = gsl::make_span(authKey);
 		if (computedAuthKeySize < kSize) {
 			base::set_bytes(authKeyBytes.subspan(0, kSize - computedAuthKeySize), gsl::byte());
diff --git a/Telegram/SourceFiles/mtproto/config_loader.cpp b/Telegram/SourceFiles/mtproto/config_loader.cpp
index 525e060d2..6ac65de5e 100644
--- a/Telegram/SourceFiles/mtproto/config_loader.cpp
+++ b/Telegram/SourceFiles/mtproto/config_loader.cpp
@@ -46,7 +46,7 @@ void ConfigLoader::load() {
 		_enumDCTimer.callOnce(kEnumerateDcTimeout);
 	} else {
 		auto ids = _instance->dcOptions()->configEnumDcIds();
-		t_assert(!ids.empty());
+		Assert(!ids.empty());
 		_enumCurrent = ids.front();
 		enumerate();
 	}
@@ -89,7 +89,7 @@ void ConfigLoader::enumerate() {
 		_enumCurrent = _instance->mainDcId();
 	}
 	auto ids = _instance->dcOptions()->configEnumDcIds();
-	t_assert(!ids.empty());
+	Assert(!ids.empty());
 
 	auto i = std::find(ids.cbegin(), ids.cend(), _enumCurrent);
 	if (i == ids.cend() || (++i) == ids.cend()) {
diff --git a/Telegram/SourceFiles/mtproto/connection.cpp b/Telegram/SourceFiles/mtproto/connection.cpp
index 369e3096b..a9c1d8713 100644
--- a/Telegram/SourceFiles/mtproto/connection.cpp
+++ b/Telegram/SourceFiles/mtproto/connection.cpp
@@ -54,7 +54,7 @@ bool IsGoodModExpFirst(const openssl::BigNum &modexp, const openssl::BigNum &pri
 	if (diff.isNegative() || diff.bitsSize() < kMinDiffBitsCount || modexp.bitsSize() < kMinDiffBitsCount) {
 		return false;
 	}
-	t_assert(modexp.bytesSize() <= kMaxModExpSize);
+	Assert(modexp.bytesSize() <= kMaxModExpSize);
 	return true;
 }
 
@@ -2396,7 +2396,7 @@ void ConnectionPrivate::pqAnswered() {
 		LOG(("AuthKey Error: could not choose public RSA key"));
 		return restart();
 	}
-	t_assert(rsaKey.isValid());
+	Assert(rsaKey.isValid());
 
 	_authKeyData->server_nonce = res_pq_data.vserver_nonce;
 	_authKeyData->new_nonce = rand_value<MTPint256>();
@@ -3036,7 +3036,7 @@ void ConnectionPrivate::unlockKey() {
 
 ConnectionPrivate::~ConnectionPrivate() {
 	clearAuthKeyData();
-	t_assert(_finished && _conn == nullptr && _conn4 == nullptr && _conn6 == nullptr);
+	Assert(_finished && _conn == nullptr && _conn4 == nullptr && _conn6 == nullptr);
 }
 
 void ConnectionPrivate::stop() {
diff --git a/Telegram/SourceFiles/mtproto/mtp_instance.cpp b/Telegram/SourceFiles/mtproto/mtp_instance.cpp
index f6906199b..255de3cd2 100644
--- a/Telegram/SourceFiles/mtproto/mtp_instance.cpp
+++ b/Telegram/SourceFiles/mtproto/mtp_instance.cpp
@@ -232,14 +232,14 @@ void Instance::Private::start(Config &&config) {
 
 	if (isKeysDestroyer()) {
 		for (auto &dc : _dcenters) {
-			t_assert(!MustNotCreateSessions);
+			Assert(!MustNotCreateSessions);
 			auto shiftedDcId = dc.first;
 			auto session = std::make_unique<internal::Session>(_instance, shiftedDcId);
 			auto it = _sessions.emplace(shiftedDcId, std::move(session)).first;
 			it->second->start();
 		}
 	} else if (_mainDcId != Config::kNoneMainDc) {
-		t_assert(!MustNotCreateSessions);
+		Assert(!MustNotCreateSessions);
 		auto main = std::make_unique<internal::Session>(_instance, _mainDcId);
 		_mainSession = main.get();
 		_sessions.emplace(_mainDcId, std::move(main));
@@ -248,7 +248,7 @@ void Instance::Private::start(Config &&config) {
 
 	_checkDelayedTimer.setCallback([this] { checkDelayedRequests(); });
 
-	t_assert((_mainDcId == Config::kNoneMainDc) == isKeysDestroyer());
+	Assert((_mainDcId == Config::kNoneMainDc) == isKeysDestroyer());
 	if (!isKeysDestroyer()) {
 		requestConfig();
 	}
@@ -324,12 +324,12 @@ void Instance::Private::restart(ShiftedDcId shiftedDcId) {
 
 int32 Instance::Private::dcstate(ShiftedDcId shiftedDcId) {
 	if (!shiftedDcId) {
-		t_assert(_mainSession != nullptr);
+		Assert(_mainSession != nullptr);
 		return _mainSession->getState();
 	}
 
 	if (!bareDcId(shiftedDcId)) {
-		t_assert(_mainSession != nullptr);
+		Assert(_mainSession != nullptr);
 		shiftedDcId += bareDcId(_mainSession->getDcWithShift());
 	}
 
@@ -343,11 +343,11 @@ int32 Instance::Private::dcstate(ShiftedDcId shiftedDcId) {
 
 QString Instance::Private::dctransport(ShiftedDcId shiftedDcId) {
 	if (!shiftedDcId) {
-		t_assert(_mainSession != nullptr);
+		Assert(_mainSession != nullptr);
 		return _mainSession->transport();
 	}
 	if (!bareDcId(shiftedDcId)) {
-		t_assert(_mainSession != nullptr);
+		Assert(_mainSession != nullptr);
 		shiftedDcId += bareDcId(_mainSession->getDcWithShift());
 	}
 
@@ -423,7 +423,7 @@ void Instance::Private::killSession(ShiftedDcId shiftedDcId) {
 	if (checkIfMainAndKill(shiftedDcId)) {
 		checkIfMainAndKill(_mainDcId);
 
-		t_assert(!MustNotCreateSessions);
+		Assert(!MustNotCreateSessions);
 		auto main = std::make_unique<internal::Session>(_instance, _mainDcId);
 		_mainSession = main.get();
 		_sessions.emplace(_mainDcId, std::move(main));
@@ -549,7 +549,7 @@ void Instance::Private::addKeysForDestroy(AuthKeysList &&keys) {
 		auto dc = std::make_shared<internal::Dcenter>(_instance, dcId, std::move(key));
 		_dcenters.emplace(shiftedDcId, std::move(dc));
 
-		t_assert(!MustNotCreateSessions);
+		Assert(!MustNotCreateSessions);
 		auto session = std::make_unique<internal::Session>(_instance, shiftedDcId);
 		auto it = _sessions.emplace(shiftedDcId, std::move(session)).first;
 		it->second->start();
@@ -1172,17 +1172,17 @@ bool Instance::Private::onErrorDefault(mtpRequestId requestId, const RPCError &e
 
 internal::Session *Instance::Private::getSession(ShiftedDcId shiftedDcId) {
 	if (!shiftedDcId) {
-		t_assert(_mainSession != nullptr);
+		Assert(_mainSession != nullptr);
 		return _mainSession;
 	}
 	if (!bareDcId(shiftedDcId)) {
-		t_assert(_mainSession != nullptr);
+		Assert(_mainSession != nullptr);
 		shiftedDcId += bareDcId(_mainSession->getDcWithShift());
 	}
 
 	auto it = _sessions.find(shiftedDcId);
 	if (it == _sessions.cend()) {
-		t_assert(!MustNotCreateSessions);
+		Assert(!MustNotCreateSessions);
 		it = _sessions.emplace(shiftedDcId, std::make_unique<internal::Session>(_instance, shiftedDcId)).first;
 		it->second->start();
 	}
diff --git a/Telegram/SourceFiles/mtproto/session.cpp b/Telegram/SourceFiles/mtproto/session.cpp
index 56d5d1498..cfe111134 100644
--- a/Telegram/SourceFiles/mtproto/session.cpp
+++ b/Telegram/SourceFiles/mtproto/session.cpp
@@ -552,7 +552,7 @@ void Session::tryToReceive() {
 }
 
 Session::~Session() {
-	t_assert(_connection == nullptr);
+	Assert(_connection == nullptr);
 }
 
 MTPrpcError rpcClientError(const QString &type, const QString &description) {
diff --git a/Telegram/SourceFiles/mtproto/special_config_request.cpp b/Telegram/SourceFiles/mtproto/special_config_request.cpp
index 1d449940c..f0d3295a7 100644
--- a/Telegram/SourceFiles/mtproto/special_config_request.cpp
+++ b/Telegram/SourceFiles/mtproto/special_config_request.cpp
@@ -204,7 +204,7 @@ void SpecialConfigRequest::handleResponse(const QByteArray &bytes) {
 	if (!decryptSimpleConfig(bytes)) {
 		return;
 	}
-	t_assert(_simpleConfig.type() == mtpc_help_configSimple);
+	Assert(_simpleConfig.type() == mtpc_help_configSimple);
 	auto &config = _simpleConfig.c_help_configSimple();
 	auto now = unixtime();
 	if (now < config.vdate.v || now > config.vexpires.v) {
@@ -216,7 +216,7 @@ void SpecialConfigRequest::handleResponse(const QByteArray &bytes) {
 		return;
 	}
 	for (auto &entry : config.vip_port_list.v) {
-		t_assert(entry.type() == mtpc_ipPort);
+		Assert(entry.type() == mtpc_ipPort);
 		auto &ipPort = entry.c_ipPort();
 		auto ip = *reinterpret_cast<const uint32*>(&ipPort.vipv4.v);
 		auto ipString = qsl("%1.%2.%3.%4").arg((ip >> 24) & 0xFF).arg((ip >> 16) & 0xFF).arg((ip >> 8) & 0xFF).arg(ip & 0xFF);
diff --git a/Telegram/SourceFiles/overview/overview_layout.cpp b/Telegram/SourceFiles/overview/overview_layout.cpp
index 9770170c1..9dbd9de6a 100644
--- a/Telegram/SourceFiles/overview/overview_layout.cpp
+++ b/Telegram/SourceFiles/overview/overview_layout.cpp
@@ -501,7 +501,7 @@ Voice::Voice(DocumentData *voice, HistoryItem *parent, const style::OverviewFile
 , _st(st) {
 	AddComponents(Info::Bit());
 
-	t_assert(_data->voice() != 0);
+	Assert(_data->voice() != 0);
 
 	setDocumentLinks(_data);
 
diff --git a/Telegram/SourceFiles/platform/linux/notifications_manager_linux.cpp b/Telegram/SourceFiles/platform/linux/notifications_manager_linux.cpp
index 55b49fe02..8c6af06b3 100644
--- a/Telegram/SourceFiles/platform/linux/notifications_manager_linux.cpp
+++ b/Telegram/SourceFiles/platform/linux/notifications_manager_linux.cpp
@@ -371,7 +371,7 @@ void Manager::Private::init(Manager *manager) {
 	// Unity and other Notify OSD users handle desktop notifications
 	// extremely poor, even without the ability to close() them.
 	_serverName = LibNotifyServerName;
-	t_assert(!_serverName.isEmpty());
+	Assert(!_serverName.isEmpty());
 	if (_serverName == qstr("notify-osd")) {
 //		_poorSupported = true;
 		_actionsSupported = false;
diff --git a/Telegram/SourceFiles/platform/mac/specific_mac.mm b/Telegram/SourceFiles/platform/mac/specific_mac.mm
index 507b898d0..a801af673 100644
--- a/Telegram/SourceFiles/platform/mac/specific_mac.mm
+++ b/Telegram/SourceFiles/platform/mac/specific_mac.mm
@@ -17,6 +17,8 @@ Copyright (c) 2014-2017 John Preston, https://desktop.telegram.org
 */
 #include "platform/mac/specific_mac.h"
 
+#include <cstdlib>
+
 #include "lang/lang_keys.h"
 #include "application.h"
 #include "mainwidget.h"
diff --git a/Telegram/SourceFiles/platform/mac/specific_mac_p.mm b/Telegram/SourceFiles/platform/mac/specific_mac_p.mm
index bb5824b42..422add55f 100644
--- a/Telegram/SourceFiles/platform/mac/specific_mac_p.mm
+++ b/Telegram/SourceFiles/platform/mac/specific_mac_p.mm
@@ -207,7 +207,7 @@ void InitOnTopPanel(QWidget *panel) {
 	panel->createWinId();
 
 	auto platformWindow = [reinterpret_cast<NSView*>(panel->winId()) window];
-	t_assert([platformWindow isKindOfClass:[NSPanel class]]);
+	Assert([platformWindow isKindOfClass:[NSPanel class]]);
 
 	auto platformPanel = static_cast<NSPanel*>(platformWindow);
 	[platformPanel setLevel:NSPopUpMenuWindowLevel];
@@ -220,7 +220,7 @@ void InitOnTopPanel(QWidget *panel) {
 
 void DeInitOnTopPanel(QWidget *panel) {
 	auto platformWindow = [reinterpret_cast<NSView*>(panel->winId()) window];
-	t_assert([platformWindow isKindOfClass:[NSPanel class]]);
+	Assert([platformWindow isKindOfClass:[NSPanel class]]);
 
 	auto platformPanel = static_cast<NSPanel*>(platformWindow);
 	auto newBehavior = ([platformPanel collectionBehavior] & (~NSWindowCollectionBehaviorCanJoinAllSpaces)) | NSWindowCollectionBehaviorMoveToActiveSpace;
@@ -229,7 +229,7 @@ void DeInitOnTopPanel(QWidget *panel) {
 
 void ReInitOnTopPanel(QWidget *panel) {
 	auto platformWindow = [reinterpret_cast<NSView*>(panel->winId()) window];
-	t_assert([platformWindow isKindOfClass:[NSPanel class]]);
+	Assert([platformWindow isKindOfClass:[NSPanel class]]);
 
 	auto platformPanel = static_cast<NSPanel*>(platformWindow);
 	auto newBehavior = ([platformPanel collectionBehavior] & (~NSWindowCollectionBehaviorMoveToActiveSpace)) | NSWindowCollectionBehaviorCanJoinAllSpaces;
diff --git a/Telegram/SourceFiles/profile/profile_block_group_members.cpp b/Telegram/SourceFiles/profile/profile_block_group_members.cpp
index 87a65c6a8..d29885ef0 100644
--- a/Telegram/SourceFiles/profile/profile_block_group_members.cpp
+++ b/Telegram/SourceFiles/profile/profile_block_group_members.cpp
@@ -108,7 +108,7 @@ void GroupMembersWidget::restrictUser(not_null<UserData*> user) {
 
 void GroupMembersWidget::removePeer(PeerData *selectedPeer) {
 	auto user = selectedPeer->asUser();
-	t_assert(user != nullptr);
+	Assert(user != nullptr);
 	auto text = lng_profile_sure_kick(lt_user, user->firstName);
 	auto currentRestrictedRights = MTP_channelBannedRights(MTP_flags(0), MTP_int(0));
 	if (auto channel = peer()->asMegagroup()) {
@@ -426,7 +426,7 @@ GroupMembersWidget::Member *GroupMembersWidget::addUser(ChannelData *megagroup,
 }
 
 void GroupMembersWidget::fillMegagroupMembers(ChannelData *megagroup) {
-	t_assert(megagroup->mgInfo != nullptr);
+	Assert(megagroup->mgInfo != nullptr);
 	if (megagroup->mgInfo->lastParticipants.isEmpty()) return;
 
 	if (!megagroup->canViewMembers()) {
@@ -486,7 +486,7 @@ void GroupMembersWidget::setItemFlags(Item *item, ChannelData *megagroup) {
 	if (item->adminState != adminState) {
 		item->adminState = adminState;
 		auto user = item->peer->asUser();
-		t_assert(user != nullptr);
+		Assert(user != nullptr);
 		if (user->botInfo) {
 			// Update "has access to messages" status.
 			item->statusText = QString();
diff --git a/Telegram/SourceFiles/profile/profile_block_shared_media.cpp b/Telegram/SourceFiles/profile/profile_block_shared_media.cpp
index b6fb131c4..8841c5605 100644
--- a/Telegram/SourceFiles/profile/profile_block_shared_media.cpp
+++ b/Telegram/SourceFiles/profile/profile_block_shared_media.cpp
@@ -151,7 +151,7 @@ void SharedMediaWidget::onMediaChosen() {
 }
 
 void SharedMediaWidget::resizeButtons(int newWidth, int *top) {
-	t_assert(top != nullptr);
+	Assert(top != nullptr);
 
 	int left = defaultOutlineButtonLeft();
 	int availableWidth = newWidth - left - st::profileBlockMarginRight;
diff --git a/Telegram/SourceFiles/profile/profile_fixed_bar.cpp b/Telegram/SourceFiles/profile/profile_fixed_bar.cpp
index 1e0e12fde..f2a6b5be1 100644
--- a/Telegram/SourceFiles/profile/profile_fixed_bar.cpp
+++ b/Telegram/SourceFiles/profile/profile_fixed_bar.cpp
@@ -135,7 +135,7 @@ void FixedBar::addRightAction(RightActionType type, base::lambda<QString()> text
 			return;
 		}
 	} else {
-		t_assert(_rightActions.size() == _currentAction);
+		Assert(_rightActions.size() == _currentAction);
 		_rightActions.push_back(RightAction());
 	}
 	_rightActions[_currentAction].type = type;
diff --git a/Telegram/SourceFiles/settings/settings_info_widget.cpp b/Telegram/SourceFiles/settings/settings_info_widget.cpp
index 14e63b7cb..086ceabde 100644
--- a/Telegram/SourceFiles/settings/settings_info_widget.cpp
+++ b/Telegram/SourceFiles/settings/settings_info_widget.cpp
@@ -189,7 +189,7 @@ int InfoWidget::LabeledWidget::resizeGetHeight(int newWidth) {
 
 	_label->moveToLeft(0, st::settingsBlockOneLineTextPart.margin.top(), newWidth);
 	auto labelNatural = _label->naturalWidth();
-	t_assert(labelNatural >= 0);
+	Assert(labelNatural >= 0);
 
 	_label->resize(qMin(newWidth, labelNatural), _label->height());
 
diff --git a/Telegram/SourceFiles/shortcuts.cpp b/Telegram/SourceFiles/shortcuts.cpp
index eca5c734f..317bd1ca2 100644
--- a/Telegram/SourceFiles/shortcuts.cpp
+++ b/Telegram/SourceFiles/shortcuts.cpp
@@ -135,7 +135,7 @@ void destroyShortcut(QShortcut *shortcut);
 
 struct DataStruct {
 	DataStruct() {
-		t_assert(DataPtr == nullptr);
+		Assert(DataPtr == nullptr);
 		DataPtr = this;
 
 		if (autoRepeatCommands.isEmpty()) {
@@ -214,16 +214,16 @@ struct DataStruct {
 namespace {
 
 void createCommand(const QString &command, ShortcutCommands::Handler handler) {
-	t_assert(DataPtr != nullptr);
-	t_assert(!command.isEmpty());
+	Assert(DataPtr != nullptr);
+	Assert(!command.isEmpty());
 
 	DataPtr->commands.insert(command, handler);
 	DataPtr->commandnames.insert(handler, command);
 }
 
 QKeySequence setShortcut(const QString &keys, const QString &command) {
-	t_assert(DataPtr != nullptr);
-	t_assert(!command.isEmpty());
+	Assert(DataPtr != nullptr);
+	Assert(!command.isEmpty());
 	if (keys.isEmpty()) return QKeySequence();
 
 	QKeySequence seq(keys, QKeySequence::PortableText);
@@ -265,7 +265,7 @@ QKeySequence setShortcut(const QString &keys, const QString &command) {
 }
 
 QKeySequence removeShortcut(const QString &keys) {
-	t_assert(DataPtr != nullptr);
+	Assert(DataPtr != nullptr);
 	if (keys.isEmpty()) return QKeySequence();
 
 	QKeySequence seq(keys, QKeySequence::PortableText);
@@ -283,7 +283,7 @@ QKeySequence removeShortcut(const QString &keys) {
 }
 
 void destroyShortcut(QShortcut *shortcut) {
-	t_assert(DataPtr != nullptr);
+	Assert(DataPtr != nullptr);
 
 	DataPtr->handlers.remove(shortcut->id());
 	DataPtr->mediaShortcuts.remove(shortcut);
@@ -293,7 +293,7 @@ void destroyShortcut(QShortcut *shortcut) {
 } // namespace
 
 void start() {
-	t_assert(Global::started());
+	Assert(Global::started());
 
 	new DataStruct();
 
@@ -411,12 +411,12 @@ void start() {
 }
 
 const QStringList &errors() {
-	t_assert(DataPtr != nullptr);
+	Assert(DataPtr != nullptr);
 	return DataPtr->errors;
 }
 
 bool launch(int shortcutId) {
-	t_assert(DataPtr != nullptr);
+	Assert(DataPtr != nullptr);
 
 	auto it = DataPtr->handlers.constFind(shortcutId);
 	if (it == DataPtr->handlers.cend()) {
@@ -426,7 +426,7 @@ bool launch(int shortcutId) {
 }
 
 bool launch(const QString &command) {
-	t_assert(DataPtr != nullptr);
+	Assert(DataPtr != nullptr);
 
 	auto it = DataPtr->commands.constFind(command);
 	if (it == DataPtr->commands.cend()) {
diff --git a/Telegram/SourceFiles/stdafx.h b/Telegram/SourceFiles/stdafx.h
index 12937bcfc..3c4a3e96f 100644
--- a/Telegram/SourceFiles/stdafx.h
+++ b/Telegram/SourceFiles/stdafx.h
@@ -62,6 +62,13 @@ Copyright (c) 2014-2017 John Preston, https://desktop.telegram.org
 #include <map>
 #include <algorithm>
 #include <memory>
+
+// Ensures/Expects.
+#include <gsl/gsl_assert>
+
+// Redefine Ensures/Expects by our own assertions.
+#include "base/assertion.h"
+
 #include <gsl/gsl>
 
 #include "base/variant.h"
diff --git a/Telegram/SourceFiles/storage/file_download.cpp b/Telegram/SourceFiles/storage/file_download.cpp
index ac1dc1391..3b82ee890 100644
--- a/Telegram/SourceFiles/storage/file_download.cpp
+++ b/Telegram/SourceFiles/storage/file_download.cpp
@@ -485,13 +485,13 @@ void mtpFileLoader::makeRequest(int offset) {
 		auto limit = partSize();
 		auto shiftedDcId = MTP::downloadDcId(requestData.dcId, requestData.dcIndex);
 		if (_cdnDcId) {
-			t_assert(requestData.dcId == _cdnDcId);
+			Assert(requestData.dcId == _cdnDcId);
 			return MTP::send(MTPupload_GetCdnFile(MTP_bytes(_cdnToken), MTP_int(offset), MTP_int(limit)), rpcDone(&mtpFileLoader::cdnPartLoaded), rpcFail(&mtpFileLoader::cdnPartFailed), shiftedDcId, 50);
 		} else if (_urlLocation) {
-			t_assert(requestData.dcId == _dcId);
+			Assert(requestData.dcId == _dcId);
 			return MTP::send(MTPupload_GetWebFile(MTP_inputWebFileLocation(MTP_bytes(_urlLocation->url()), MTP_long(_urlLocation->accessHash())), MTP_int(offset), MTP_int(limit)), rpcDone(&mtpFileLoader::webPartLoaded), rpcFail(&mtpFileLoader::partFailed), shiftedDcId, 50);
 		} else {
-			t_assert(requestData.dcId == _dcId);
+			Assert(requestData.dcId == _dcId);
 			auto location = [this] {
 				if (_location) {
 					return MTP_inputFileLocation(MTP_long(_location->volume()), MTP_int(_location->local()), MTP_long(_location->secret()));
@@ -806,7 +806,7 @@ void mtpFileLoader::switchToCDN(int offset, const MTPDupload_fileCdnRedirect &re
 
 void mtpFileLoader::addCdnHashes(const QVector<MTPCdnFileHash> &hashes) {
 	for_const (auto &hash, hashes) {
-		t_assert(hash.type() == mtpc_cdnFileHash);
+		Assert(hash.type() == mtpc_cdnFileHash);
 		auto &data = hash.c_cdnFileHash();
 		_cdnFileHashes.emplace(data.voffset.v, CdnFileHash { data.vlimit.v, data.vhash.v });
 	}
diff --git a/Telegram/SourceFiles/storage/localimageloader.cpp b/Telegram/SourceFiles/storage/localimageloader.cpp
index 028c1154c..fbb2ecc85 100644
--- a/Telegram/SourceFiles/storage/localimageloader.cpp
+++ b/Telegram/SourceFiles/storage/localimageloader.cpp
@@ -343,7 +343,7 @@ void FileLoadTask::process() {
 		// Voice sending is supported only from memory for now.
 		// Because for voice we force mime type and don't read MediaInformation.
 		// For a real file we always read mime type and read MediaInformation.
-		t_assert(!isVoice);
+		Assert(!isVoice);
 
 		filesize = info.size();
 		filename = info.fileName();
diff --git a/Telegram/SourceFiles/structs.cpp b/Telegram/SourceFiles/structs.cpp
index 7c4136c33..f025a5364 100644
--- a/Telegram/SourceFiles/structs.cpp
+++ b/Telegram/SourceFiles/structs.cpp
@@ -2194,6 +2194,6 @@ GameData::GameData(const GameId &id, const uint64 &accessHash, const QString &sh
 
 MsgId clientMsgId() {
 	static MsgId currentClientMsgId = StartClientMsgId;
-	t_assert(currentClientMsgId < EndClientMsgId);
+	Assert(currentClientMsgId < EndClientMsgId);
 	return currentClientMsgId++;
 }
diff --git a/Telegram/SourceFiles/ui/animation.h b/Telegram/SourceFiles/ui/animation.h
index e6ebe4a12..3a5dcc734 100644
--- a/Telegram/SourceFiles/ui/animation.h
+++ b/Telegram/SourceFiles/ui/animation.h
@@ -616,7 +616,7 @@ public:
 	}
 
 	float64 current() const {
-		t_assert(_data != nullptr);
+		Assert(_data != nullptr);
 		return _data->value.current();
 	}
 	float64 current(float64 def) const {
diff --git a/Telegram/SourceFiles/ui/effects/panel_animation.cpp b/Telegram/SourceFiles/ui/effects/panel_animation.cpp
index 761146756..f015f0f57 100644
--- a/Telegram/SourceFiles/ui/effects/panel_animation.cpp
+++ b/Telegram/SourceFiles/ui/effects/panel_animation.cpp
@@ -23,7 +23,7 @@ Copyright (c) 2014-2017 John Preston, https://desktop.telegram.org
 namespace Ui {
 
 void RoundShadowAnimation::start(int frameWidth, int frameHeight, float64 devicePixelRatio) {
-	t_assert(!started());
+	Assert(!started());
 	_frameWidth = frameWidth;
 	_frameHeight = frameHeight;
 	_frame = QImage(_frameWidth, _frameHeight, QImage::Format_ARGB32_Premultiplied);
@@ -31,9 +31,9 @@ void RoundShadowAnimation::start(int frameWidth, int frameHeight, float64 device
 	_frameIntsPerLine = (_frame.bytesPerLine() >> 2);
 	_frameInts = reinterpret_cast<uint32*>(_frame.bits());
 	_frameIntsPerLineAdded = _frameIntsPerLine - _frameWidth;
-	t_assert(_frame.depth() == static_cast<int>(sizeof(uint32) << 3));
-	t_assert(_frame.bytesPerLine() == (_frameIntsPerLine << 2));
-	t_assert(_frameIntsPerLineAdded >= 0);
+	Assert(_frame.depth() == static_cast<int>(sizeof(uint32) << 3));
+	Assert(_frame.bytesPerLine() == (_frameIntsPerLine << 2));
+	Assert(_frameIntsPerLineAdded >= 0);
 }
 
 void RoundShadowAnimation::setShadow(const style::Shadow &st) {
@@ -47,7 +47,7 @@ void RoundShadowAnimation::setShadow(const style::Shadow &st) {
 		_shadow.bottomRight = cloneImage(st.bottomRight);
 		_shadow.bottom = cloneImage(st.bottom);
 		_shadow.bottomLeft = cloneImage(st.bottomLeft);
-		t_assert(!_shadow.topLeft.isNull()
+		Assert(!_shadow.topLeft.isNull()
 			&& !_shadow.top.isNull()
 			&& !_shadow.topRight.isNull()
 			&& !_shadow.right.isNull()
@@ -73,7 +73,7 @@ void RoundShadowAnimation::setCornerMasks(const QImage &topLeft, const QImage &t
 }
 
 void RoundShadowAnimation::setCornerMask(Corner &corner, const QImage &image) {
-	t_assert(!started());
+	Assert(!started());
 	corner.image = image;
 	if (corner.valid()) {
 		corner.width = corner.image.width();
@@ -81,8 +81,8 @@ void RoundShadowAnimation::setCornerMask(Corner &corner, const QImage &image) {
 		corner.bytes = corner.image.constBits();
 		corner.bytesPerPixel = (corner.image.depth() >> 3);
 		corner.bytesPerLineAdded = corner.image.bytesPerLine() - corner.width * corner.bytesPerPixel;
-		t_assert(corner.image.depth() == (corner.bytesPerPixel << 3));
-		t_assert(corner.bytesPerLineAdded >= 0);
+		Assert(corner.image.depth() == (corner.bytesPerPixel << 3));
+		Assert(corner.bytesPerLineAdded >= 0);
 	} else {
 		corner.width = corner.height = 0;
 	}
@@ -227,25 +227,25 @@ void RoundShadowAnimation::paintShadowHorizontal(int left, int right, int top, c
 }
 
 void PanelAnimation::setFinalImage(QImage &&finalImage, QRect inner) {
-	t_assert(!started());
+	Assert(!started());
 	_finalImage = App::pixmapFromImageInPlace(std::move(finalImage).convertToFormat(QImage::Format_ARGB32_Premultiplied));
 
-	t_assert(!_finalImage.isNull());
+	Assert(!_finalImage.isNull());
 	_finalWidth = _finalImage.width();
 	_finalHeight = _finalImage.height();
-	t_assert(!(_finalWidth % cIntRetinaFactor()));
-	t_assert(!(_finalHeight % cIntRetinaFactor()));
+	Assert(!(_finalWidth % cIntRetinaFactor()));
+	Assert(!(_finalHeight % cIntRetinaFactor()));
 	_finalInnerLeft = inner.x();
 	_finalInnerTop = inner.y();
 	_finalInnerWidth = inner.width();
 	_finalInnerHeight = inner.height();
-	t_assert(!(_finalInnerLeft % cIntRetinaFactor()));
-	t_assert(!(_finalInnerTop % cIntRetinaFactor()));
-	t_assert(!(_finalInnerWidth % cIntRetinaFactor()));
-	t_assert(!(_finalInnerHeight % cIntRetinaFactor()));
+	Assert(!(_finalInnerLeft % cIntRetinaFactor()));
+	Assert(!(_finalInnerTop % cIntRetinaFactor()));
+	Assert(!(_finalInnerWidth % cIntRetinaFactor()));
+	Assert(!(_finalInnerHeight % cIntRetinaFactor()));
 	_finalInnerRight = _finalInnerLeft + _finalInnerWidth;
 	_finalInnerBottom = _finalInnerTop + _finalInnerHeight;
-	t_assert(QRect(0, 0, _finalWidth, _finalHeight).contains(inner));
+	Assert(QRect(0, 0, _finalWidth, _finalHeight).contains(inner));
 
 	setStartWidth();
 	setStartHeight();
@@ -263,8 +263,8 @@ void PanelAnimation::setFinalImage(QImage &&finalImage, QRect inner) {
 		if (!corner.valid()) return;
 		if ((_startWidth >= 0 && _startWidth < _finalWidth)
 			|| (_startHeight >= 0 && _startHeight < _finalHeight)) {
-			t_assert(corner.width <= inner.width());
-			t_assert(corner.height <= inner.height());
+			Assert(corner.width <= inner.width());
+			Assert(corner.height <= inner.height());
 		}
 	};
 	checkCorner(_topLeft);
@@ -275,17 +275,17 @@ void PanelAnimation::setFinalImage(QImage &&finalImage, QRect inner) {
 
 void PanelAnimation::setStartWidth() {
 	_startWidth = qRound(_st.startWidth * _finalInnerWidth);
-	if (_startWidth >= 0) t_assert(_startWidth <= _finalInnerWidth);
+	if (_startWidth >= 0) Assert(_startWidth <= _finalInnerWidth);
 }
 
 void PanelAnimation::setStartHeight() {
 	_startHeight = qRound(_st.startHeight * _finalInnerHeight);
-	if (_startHeight >= 0) t_assert(_startHeight <= _finalInnerHeight);
+	if (_startHeight >= 0) Assert(_startHeight <= _finalInnerHeight);
 }
 
 void PanelAnimation::setStartAlpha() {
 	_startAlpha = qRound(_st.startOpacity * 255);
-	t_assert(_startAlpha >= 0 && _startAlpha < 256);
+	Assert(_startAlpha >= 0 && _startAlpha < 256);
 }
 
 void PanelAnimation::setStartFadeTop() {
@@ -298,7 +298,7 @@ void PanelAnimation::createFadeMask() {
 		resultHeight -= remove;
 	}
 	auto finalAlpha = qRound(_st.fadeOpacity * 255);
-	t_assert(finalAlpha >= 0 && finalAlpha < 256);
+	Assert(finalAlpha >= 0 && finalAlpha < 256);
 	auto result = QImage(cIntRetinaFactor(), resultHeight, QImage::Format_ARGB32_Premultiplied);
 	auto ints = reinterpret_cast<uint32*>(result.bits());
 	auto intsPerLineAdded = (result.bytesPerLine() >> 2) - cIntRetinaFactor();
@@ -321,39 +321,39 @@ void PanelAnimation::createFadeMask() {
 }
 
 void PanelAnimation::setSkipShadow(bool skipShadow) {
-	t_assert(!started());
+	Assert(!started());
 	_skipShadow = skipShadow;
 }
 
 void PanelAnimation::setWidthDuration() {
 	_widthDuration = _st.widthDuration;
-	t_assert(_widthDuration >= 0.);
-	t_assert(_widthDuration <= 1.);
+	Assert(_widthDuration >= 0.);
+	Assert(_widthDuration <= 1.);
 }
 
 void PanelAnimation::setHeightDuration() {
-	t_assert(!started());
+	Assert(!started());
 	_heightDuration = _st.heightDuration;
-	t_assert(_heightDuration >= 0.);
-	t_assert(_heightDuration <= 1.);
+	Assert(_heightDuration >= 0.);
+	Assert(_heightDuration <= 1.);
 }
 
 void PanelAnimation::setAlphaDuration() {
-	t_assert(!started());
+	Assert(!started());
 	_alphaDuration = _st.opacityDuration;
-	t_assert(_alphaDuration >= 0.);
-	t_assert(_alphaDuration <= 1.);
+	Assert(_alphaDuration >= 0.);
+	Assert(_alphaDuration <= 1.);
 }
 
 void PanelAnimation::start() {
-	t_assert(!_finalImage.isNull());
+	Assert(!_finalImage.isNull());
 	RoundShadowAnimation::start(_finalWidth, _finalHeight, _finalImage.devicePixelRatio());
 	auto checkCorner = [this](const Corner &corner) {
 		if (!corner.valid()) return;
-		if (_startWidth >= 0) t_assert(corner.width <= _startWidth);
-		if (_startHeight >= 0) t_assert(corner.height <= _startHeight);
-		t_assert(corner.width <= _finalInnerWidth);
-		t_assert(corner.height <= _finalInnerHeight);
+		if (_startWidth >= 0) Assert(corner.width <= _startWidth);
+		if (_startHeight >= 0) Assert(corner.height <= _startHeight);
+		Assert(corner.width <= _finalInnerWidth);
+		Assert(corner.height <= _finalInnerHeight);
 	};
 	checkCorner(_topLeft);
 	checkCorner(_topRight);
@@ -362,8 +362,8 @@ void PanelAnimation::start() {
 }
 
 void PanelAnimation::paintFrame(QPainter &p, int x, int y, int outerWidth, float64 dt, float64 opacity) {
-	t_assert(started());
-	t_assert(dt >= 0.);
+	Assert(started());
+	Assert(dt >= 0.);
 
 	auto &transition = anim::easeOutCirc;
 	if (dt < _alphaDuration) opacity *= transition(1., dt / _alphaDuration);
diff --git a/Telegram/SourceFiles/ui/effects/slide_animation.cpp b/Telegram/SourceFiles/ui/effects/slide_animation.cpp
index efb5d6c5a..8d8f64922 100644
--- a/Telegram/SourceFiles/ui/effects/slide_animation.cpp
+++ b/Telegram/SourceFiles/ui/effects/slide_animation.cpp
@@ -25,8 +25,8 @@ namespace Ui {
 void SlideAnimation::setSnapshots(QPixmap leftSnapshot, QPixmap rightSnapshot) {
 	_leftSnapshot = std::move(leftSnapshot);
 	_rightSnapshot = std::move(rightSnapshot);
-	t_assert(!_leftSnapshot.isNull());
-	t_assert(!_rightSnapshot.isNull());
+	Assert(!_leftSnapshot.isNull());
+	Assert(!_rightSnapshot.isNull());
 	_leftSnapshot.setDevicePixelRatio(cRetinaFactor());
 	_rightSnapshot.setDevicePixelRatio(cRetinaFactor());
 }
diff --git a/Telegram/SourceFiles/ui/images.cpp b/Telegram/SourceFiles/ui/images.cpp
index 57408922f..73d4a975a 100644
--- a/Telegram/SourceFiles/ui/images.cpp
+++ b/Telegram/SourceFiles/ui/images.cpp
@@ -33,7 +33,7 @@ FORCE_INLINE uint64 blurGetColors(const uchar *p) {
 }
 
 const QPixmap &circleMask(int width, int height) {
-	t_assert(Global::started());
+	Assert(Global::started());
 
 	uint64 key = uint64(uint32(width)) << 32 | uint64(uint32(height));
 
@@ -65,7 +65,7 @@ QImage prepareBlur(QImage img) {
 	if (fmt != QImage::Format_RGB32 && fmt != QImage::Format_ARGB32_Premultiplied) {
 		img = img.convertToFormat(QImage::Format_ARGB32_Premultiplied);
 		img.setDevicePixelRatio(ratio);
-		t_assert(!img.isNull());
+		Assert(!img.isNull());
 	}
 
 	uchar *pix = img.bits();
@@ -91,7 +91,7 @@ QImage prepareBlur(QImage img) {
 				auto was = img;
 				img = std::move(imgsmall);
 				imgsmall = QImage();
-				t_assert(!img.isNull());
+				Assert(!img.isNull());
 
 				pix = img.bits();
 				if (!pix) return was;
@@ -179,11 +179,11 @@ yi += stride;
 }
 
 void prepareCircle(QImage &img) {
-	t_assert(!img.isNull());
+	Assert(!img.isNull());
 
 	img.setDevicePixelRatio(cRetinaFactor());
 	img = img.convertToFormat(QImage::Format_ARGB32_Premultiplied);
-	t_assert(!img.isNull());
+	Assert(!img.isNull());
 
 	QPixmap mask = circleMask(img.width(), img.height());
 	Painter p(&img);
@@ -195,14 +195,14 @@ void prepareRound(QImage &image, ImageRoundRadius radius, ImageRoundCorners corn
 	if (!static_cast<int>(corners)) {
 		return;
 	} else if (radius == ImageRoundRadius::Ellipse) {
-		t_assert(corners == ImageRoundCorners(ImageRoundCorner::All));
+		Assert(corners == ImageRoundCorners(ImageRoundCorner::All));
 		prepareCircle(image);
 	}
-	t_assert(!image.isNull());
+	Assert(!image.isNull());
 
 	image.setDevicePixelRatio(cRetinaFactor());
 	image = std::move(image).convertToFormat(QImage::Format_ARGB32_Premultiplied);
-	t_assert(!image.isNull());
+	Assert(!image.isNull());
 
 	auto masks = App::cornersMask(radius);
 	prepareRound(image, masks, corners);
@@ -218,8 +218,8 @@ void prepareRound(QImage &image, QImage *cornerMasks, ImageRoundCorners corners)
 	}
 	constexpr auto imageIntsPerPixel = 1;
 	auto imageIntsPerLine = (image.bytesPerLine() >> 2);
-	t_assert(image.depth() == static_cast<int>((imageIntsPerPixel * sizeof(uint32)) << 3));
-	t_assert(image.bytesPerLine() == (imageIntsPerLine << 2));
+	Assert(image.depth() == static_cast<int>((imageIntsPerPixel * sizeof(uint32)) << 3));
+	Assert(image.bytesPerLine() == (imageIntsPerLine << 2));
 
 	auto ints = reinterpret_cast<uint32*>(image.bits());
 	auto intsTopLeft = ints;
@@ -233,10 +233,10 @@ void prepareRound(QImage &image, QImage *cornerMasks, ImageRoundCorners corners)
 		auto maskBytesPerLine = mask.bytesPerLine();
 		auto maskBytesAdded = maskBytesPerLine - maskWidth * maskBytesPerPixel;
 		auto maskBytes = mask.constBits();
-		t_assert(maskBytesAdded >= 0);
-		t_assert(mask.depth() == (maskBytesPerPixel << 3));
+		Assert(maskBytesAdded >= 0);
+		Assert(mask.depth() == (maskBytesPerPixel << 3));
 		auto imageIntsAdded = imageIntsPerLine - maskWidth * imageIntsPerPixel;
-		t_assert(imageIntsAdded >= 0);
+		Assert(imageIntsAdded >= 0);
 		for (auto y = 0; y != maskHeight; ++y) {
 			for (auto x = 0; x != maskWidth; ++x) {
 				auto opacity = static_cast<anim::ShiftedMultiplier>(*maskBytes) + 1;
@@ -294,18 +294,18 @@ QImage prepareOpaque(QImage image) {
 }
 
 QImage prepare(QImage img, int w, int h, Images::Options options, int outerw, int outerh, const style::color *colored) {
-	t_assert(!img.isNull());
+	Assert(!img.isNull());
 	if (options.testFlag(Images::Option::Blurred)) {
 		img = prepareBlur(std::move(img));
-		t_assert(!img.isNull());
+		Assert(!img.isNull());
 	}
 	if (w <= 0 || (w == img.width() && (h <= 0 || h == img.height()))) {
 	} else if (h <= 0) {
 		img = img.scaledToWidth(w, options.testFlag(Images::Option::Smooth) ? Qt::SmoothTransformation : Qt::FastTransformation);
-		t_assert(!img.isNull());
+		Assert(!img.isNull());
 	} else {
 		img = img.scaled(w, h, Qt::IgnoreAspectRatio, options.testFlag(Images::Option::Smooth) ? Qt::SmoothTransformation : Qt::FastTransformation);
-		t_assert(!img.isNull());
+		Assert(!img.isNull());
 	}
 	if (outerw > 0 && outerh > 0) {
 		outerw *= cIntRetinaFactor();
@@ -325,7 +325,7 @@ QImage prepare(QImage img, int w, int h, Images::Options options, int outerw, in
 				p.drawImage((result.width() - img.width()) / (2 * cIntRetinaFactor()), (result.height() - img.height()) / (2 * cIntRetinaFactor()), img);
 			}
 			img = result;
-			t_assert(!img.isNull());
+			Assert(!img.isNull());
 		}
 	}
 	auto corners = [](Images::Options options) {
@@ -336,16 +336,16 @@ QImage prepare(QImage img, int w, int h, Images::Options options, int outerw, in
 	};
 	if (options.testFlag(Images::Option::Circled)) {
 		prepareCircle(img);
-		t_assert(!img.isNull());
+		Assert(!img.isNull());
 	} else if (options.testFlag(Images::Option::RoundedLarge)) {
 		prepareRound(img, ImageRoundRadius::Large, corners(options));
-		t_assert(!img.isNull());
+		Assert(!img.isNull());
 	} else if (options.testFlag(Images::Option::RoundedSmall)) {
 		prepareRound(img, ImageRoundRadius::Small, corners(options));
-		t_assert(!img.isNull());
+		Assert(!img.isNull());
 	}
 	if (options.testFlag(Images::Option::Colored)) {
-		t_assert(colored != nullptr);
+		Assert(colored != nullptr);
 		img = prepareColored(*colored, std::move(img));
 	}
 	img.setDevicePixelRatio(cRetinaFactor());
@@ -742,7 +742,7 @@ QPixmap Image::pixNoCache(int w, int h, Images::Options options, int outerw, int
 			Images::prepareRound(result, ImageRoundRadius::Small, corners(options));
 		}
 		if (options.testFlag(Images::Option::Colored)) {
-			t_assert(colored != nullptr);
+			Assert(colored != nullptr);
 			result = Images::prepareColored(*colored, std::move(result));
 		}
 		return App::pixmapFromImageInPlace(std::move(result));
diff --git a/Telegram/SourceFiles/ui/style/style_core.cpp b/Telegram/SourceFiles/ui/style/style_core.cpp
index 6f8766bb0..a316ccb25 100644
--- a/Telegram/SourceFiles/ui/style/style_core.cpp
+++ b/Telegram/SourceFiles/ui/style/style_core.cpp
@@ -78,11 +78,11 @@ void colorizeImage(const QImage &src, QColor c, QImage *outResult, QRect srcRect
 	if (srcRect.isNull()) {
 		srcRect = src.rect();
 	} else {
-		t_assert(src.rect().contains(srcRect));
+		Assert(src.rect().contains(srcRect));
 	}
 	auto width = srcRect.width();
 	auto height = srcRect.height();
-	t_assert(outResult && outResult->rect().contains(QRect(dstPoint, srcRect.size())));
+	Assert(outResult && outResult->rect().contains(QRect(dstPoint, srcRect.size())));
 
 	auto pattern = anim::shifted(c);
 
@@ -91,16 +91,16 @@ void colorizeImage(const QImage &src, QColor c, QImage *outResult, QRect srcRect
 	auto resultIntsPerLine = (outResult->bytesPerLine() >> 2);
 	auto resultIntsAdded = resultIntsPerLine - width * resultIntsPerPixel;
 	auto resultInts = reinterpret_cast<uint32*>(outResult->bits()) + dstPoint.y() * resultIntsPerLine + dstPoint.x() * resultIntsPerPixel;
-	t_assert(resultIntsAdded >= 0);
-	t_assert(outResult->depth() == static_cast<int>((resultIntsPerPixel * sizeof(uint32)) << 3));
-	t_assert(outResult->bytesPerLine() == (resultIntsPerLine << 2));
+	Assert(resultIntsAdded >= 0);
+	Assert(outResult->depth() == static_cast<int>((resultIntsPerPixel * sizeof(uint32)) << 3));
+	Assert(outResult->bytesPerLine() == (resultIntsPerLine << 2));
 
 	auto maskBytesPerPixel = (src.depth() >> 3);
 	auto maskBytesPerLine = src.bytesPerLine();
 	auto maskBytesAdded = maskBytesPerLine - width * maskBytesPerPixel;
 	auto maskBytes = src.constBits() + srcRect.y() * maskBytesPerLine + srcRect.x() * maskBytesPerPixel;
-	t_assert(maskBytesAdded >= 0);
-	t_assert(src.depth() == (maskBytesPerPixel << 3));
+	Assert(maskBytesAdded >= 0);
+	Assert(src.depth() == (maskBytesPerPixel << 3));
 	for (int y = 0; y != height; ++y) {
 		for (int x = 0; x != width; ++x) {
 			auto maskOpacity = static_cast<anim::ShiftedMultiplier>(*maskBytes) + 1;
diff --git a/Telegram/SourceFiles/ui/style/style_core_icon.cpp b/Telegram/SourceFiles/ui/style/style_core_icon.cpp
index c3eedc584..5a7fb16a0 100644
--- a/Telegram/SourceFiles/ui/style/style_core_icon.cpp
+++ b/Telegram/SourceFiles/ui/style/style_core_icon.cpp
@@ -45,7 +45,7 @@ inline int pxAdjust(int value, int scale) {
 QImage createIconMask(const IconMask *mask, DBIScale scale) {
 	auto maskImage = QImage::fromData(mask->data(), mask->size(), "PNG");
 	maskImage.setDevicePixelRatio(cRetinaFactor());
-	t_assert(!maskImage.isNull());
+	Assert(!maskImage.isNull());
 
 	// images are layouted like this:
 	// 200x 100x
@@ -89,7 +89,7 @@ QSize readGeneratedSize(const IconMask *mask, DBIScale scale) {
 
 			qint32 width = 0, height = 0;
 			stream >> width >> height;
-			t_assert(stream.status() == QDataStream::Ok);
+			Assert(stream.status() == QDataStream::Ok);
 
 			switch (scale) {
 			case dbisOne: return QSize(width, height);
@@ -284,8 +284,8 @@ void IconData::fill(QPainter &p, const QRect &rect) const {
 
 	auto partSize = _parts[0].size();
 	for_const (auto &part, _parts) {
-		t_assert(part.offset() == QPoint(0, 0));
-		t_assert(part.size() == partSize);
+		Assert(part.offset() == QPoint(0, 0));
+		Assert(part.size() == partSize);
 		part.fill(p, rect);
 	}
 }
@@ -295,16 +295,16 @@ void IconData::fill(QPainter &p, const QRect &rect, QColor colorOverride) const
 
 	auto partSize = _parts[0].size();
 	for_const (auto &part, _parts) {
-		t_assert(part.offset() == QPoint(0, 0));
-		t_assert(part.size() == partSize);
+		Assert(part.offset() == QPoint(0, 0));
+		Assert(part.size() == partSize);
 		part.fill(p, rect, colorOverride);
 	}
 }
 
 QImage IconData::instance(QColor colorOverride, DBIScale scale) const {
-	t_assert(_parts.size() == 1);
+	Assert(_parts.size() == 1);
 	auto &part = _parts[0];
-	t_assert(part.offset() == QPoint(0, 0));
+	Assert(part.offset() == QPoint(0, 0));
 	return part.instance(colorOverride, scale);
 }
 
diff --git a/Telegram/SourceFiles/ui/style/style_core_icon.h b/Telegram/SourceFiles/ui/style/style_core_icon.h
index 808faa9c1..edfe52c11 100644
--- a/Telegram/SourceFiles/ui/style/style_core_icon.h
+++ b/Telegram/SourceFiles/ui/style/style_core_icon.h
@@ -166,13 +166,13 @@ public:
 	Icon(Icon &&other) : _data(base::take(other._data)), _owner(base::take(_owner)) {
 	}
 	Icon &operator=(const Icon &other) {
-		t_assert(!_owner);
+		Assert(!_owner);
 		_data = other._data;
 		_owner = false;
 		return *this;
 	}
 	Icon &operator=(Icon &&other) {
-		t_assert(!_owner);
+		Assert(!_owner);
 		_data = base::take(other._data);
 		_owner = base::take(other._owner);
 		return *this;
diff --git a/Telegram/SourceFiles/ui/widgets/buttons.cpp b/Telegram/SourceFiles/ui/widgets/buttons.cpp
index bfdcdf01a..9f93baf57 100644
--- a/Telegram/SourceFiles/ui/widgets/buttons.cpp
+++ b/Telegram/SourceFiles/ui/widgets/buttons.cpp
@@ -686,7 +686,7 @@ bool CrossButton::stopLoadingAnimation(TimeMs ms) {
 	auto stopPeriod = (_loadingStopMs - _loadingStartMs) / _st.loadingPeriod;
 	auto currentPeriod = (ms - _loadingStartMs) / _st.loadingPeriod;
 	if (currentPeriod != stopPeriod) {
-		t_assert(currentPeriod > stopPeriod);
+		Assert(currentPeriod > stopPeriod);
 		return true;
 	}
 	return false;
diff --git a/Telegram/SourceFiles/ui/widgets/checkbox.cpp b/Telegram/SourceFiles/ui/widgets/checkbox.cpp
index 66fd36534..28cba1b91 100644
--- a/Telegram/SourceFiles/ui/widgets/checkbox.cpp
+++ b/Telegram/SourceFiles/ui/widgets/checkbox.cpp
@@ -113,8 +113,8 @@ void ToggleView::paint(Painter &p, int left, int top, int outerWidth, TimeMs ms)
 }
 
 void ToggleView::paintXV(Painter &p, int left, int top, int outerWidth, float64 toggled, const QBrush &brush) {
-	t_assert(_st->vsize > 0);
-	t_assert(_st->stroke > 0);
+	Assert(_st->vsize > 0);
+	Assert(_st->stroke > 0);
 	static const auto sqrt2 = sqrt(2.);
 	auto stroke = (0. + _st->stroke) / sqrt2;
 	if (toggled < 1) {
diff --git a/Telegram/SourceFiles/ui/widgets/discrete_sliders.cpp b/Telegram/SourceFiles/ui/widgets/discrete_sliders.cpp
index 6657c4dd7..8f1fb8941 100644
--- a/Telegram/SourceFiles/ui/widgets/discrete_sliders.cpp
+++ b/Telegram/SourceFiles/ui/widgets/discrete_sliders.cpp
@@ -76,7 +76,7 @@ void DiscreteSlider::addSection(const QString &label) {
 }
 
 void DiscreteSlider::setSections(const QStringList &labels) {
-	t_assert(!labels.isEmpty());
+	Assert(!labels.isEmpty());
 
 	_sections.clear();
 	for_const (auto &label, labels) {
diff --git a/Telegram/SourceFiles/ui/widgets/input_fields.cpp b/Telegram/SourceFiles/ui/widgets/input_fields.cpp
index 9e9bf9338..08bb4d7f2 100644
--- a/Telegram/SourceFiles/ui/widgets/input_fields.cpp
+++ b/Telegram/SourceFiles/ui/widgets/input_fields.cpp
@@ -404,8 +404,8 @@ EmojiPtr FlatTextarea::getSingleEmoji() const {
 }
 
 QString FlatTextarea::getInlineBotQuery(UserData **outInlineBot, QString *outInlineBotUsername) const {
-	t_assert(outInlineBot != nullptr);
-	t_assert(outInlineBotUsername != nullptr);
+	Assert(outInlineBot != nullptr);
+	Assert(outInlineBotUsername != nullptr);
 
 	auto &text = getTextWithTags().text;
 	auto textLength = text.size();
@@ -525,7 +525,7 @@ void FlatTextarea::insertTag(const QString &text, QString tagId) {
 	auto block = doc->findBlock(pos);
 	for (auto iter = block.begin(); !iter.atEnd(); ++iter) {
 		auto fragment = iter.fragment();
-		t_assert(fragment.isValid());
+		Assert(fragment.isValid());
 
 		int fragmentPosition = fragment.position();
 		int fragmentEnd = (fragmentPosition + fragment.length());
@@ -657,7 +657,7 @@ public:
 
 		if (!_currentTagId.isEmpty()) {
 			int randomPartPosition = _currentTagId.lastIndexOf('/');
-			t_assert(randomPartPosition > 0);
+			Assert(randomPartPosition > 0);
 
 			bool tagChanged = true;
 			if (_currentTag < _tags->size()) {
@@ -1100,7 +1100,7 @@ void FlatTextarea::processFormatting(int insertPosition, int insertEnd) {
 		for (auto block = fromBlock; block != tillBlock; block = block.next()) {
 			for (auto fragmentIt = block.begin(); !fragmentIt.atEnd(); ++fragmentIt) {
 				auto fragment = fragmentIt.fragment();
-				t_assert(fragment.isValid());
+				Assert(fragment.isValid());
 
 				int fragmentPosition = fragment.position();
 				if (insertPosition >= fragmentPosition + fragment.length()) {
diff --git a/Telegram/SourceFiles/ui/widgets/multi_select.cpp b/Telegram/SourceFiles/ui/widgets/multi_select.cpp
index a60f29ac5..e73c441ba 100644
--- a/Telegram/SourceFiles/ui/widgets/multi_select.cpp
+++ b/Telegram/SourceFiles/ui/widgets/multi_select.cpp
@@ -214,7 +214,7 @@ QRect MultiSelect::Item::paintArea(int outerWidth) const {
 void MultiSelect::Item::prepareCache() {
 	if (!_cache.isNull()) return;
 
-	t_assert(!_visibility.animating());
+	Assert(!_visibility.animating());
 	auto cacheWidth = _width * kWideScale * cIntRetinaFactor();
 	auto cacheHeight = _st.height * kWideScale * cIntRetinaFactor();
 	auto data = QImage(cacheWidth, cacheHeight, QImage::Format_ARGB32_Premultiplied);
@@ -441,12 +441,12 @@ void MultiSelect::Inner::setActiveItem(int active, ChangeActiveWay skipSetFocus)
 	if (_active == active) return;
 
 	if (_active >= 0) {
-		t_assert(_active < _items.size());
+		Assert(_active < _items.size());
 		_items[_active]->setActive(false);
 	}
 	_active = active;
 	if (_active >= 0) {
-		t_assert(_active < _items.size());
+		Assert(_active < _items.size());
 		_items[_active]->setActive(true);
 	}
 	if (skipSetFocus != ChangeActiveWay::SkipSetFocus) {
@@ -594,7 +594,7 @@ void MultiSelect::Inner::updateSelection(QPoint mousePosition) {
 	}
 	if (_selected != selected) {
 		if (_selected >= 0) {
-			t_assert(_selected < _items.size());
+			Assert(_selected < _items.size());
 			_items[_selected]->leaveEvent();
 		}
 		_selected = selected;
@@ -657,7 +657,7 @@ void MultiSelect::Inner::computeItemsGeometry(int newWidth) {
 	auto maxVisiblePadding = qMax(_st.padding.left(), _st.padding.right());
 	for_const (auto &item, _items) {
 		auto itemWidth = item->getWidth();
-		t_assert(itemWidth <= newWidth);
+		Assert(itemWidth <= newWidth);
 		if (itemWidth > widthLeft) {
 			itemLeft = 0;
 			itemTop += _st.item.height + _st.itemSkip;
@@ -669,7 +669,7 @@ void MultiSelect::Inner::computeItemsGeometry(int newWidth) {
 	}
 
 	auto fieldMinWidth = _st.fieldMinWidth + _st.fieldCancelSkip;
-	t_assert(fieldMinWidth <= newWidth);
+	Assert(fieldMinWidth <= newWidth);
 	if (fieldMinWidth > widthLeft) {
 		_fieldLeft = 0;
 		_fieldTop = itemTop + _st.item.height + _st.itemSkip;
diff --git a/Telegram/SourceFiles/ui/widgets/scroll_area.cpp b/Telegram/SourceFiles/ui/widgets/scroll_area.cpp
index ca5072bc3..a493b647e 100644
--- a/Telegram/SourceFiles/ui/widgets/scroll_area.cpp
+++ b/Telegram/SourceFiles/ui/widgets/scroll_area.cpp
@@ -26,8 +26,8 @@ namespace Ui {
 
 ScrollShadow::ScrollShadow(ScrollArea *parent, const style::ScrollArea *st) : QWidget(parent), _st(st) {
 	setVisible(false);
-	t_assert(_st != nullptr);
-	t_assert(_st->shColor.v() != nullptr);
+	Assert(_st != nullptr);
+	Assert(_st->shColor.v() != nullptr);
 }
 
 void ScrollShadow::paintEvent(QPaintEvent *e) {
diff --git a/Telegram/SourceFiles/window/themes/window_theme.cpp b/Telegram/SourceFiles/window/themes/window_theme.cpp
index c0529e974..596347438 100644
--- a/Telegram/SourceFiles/window/themes/window_theme.cpp
+++ b/Telegram/SourceFiles/window/themes/window_theme.cpp
@@ -345,7 +345,7 @@ void adjustColor(style::color color, float64 hue, float64 saturation) {
 }
 
 void adjustColorsUsingBackground(const QImage &img) {
-	t_assert(img.format() == QImage::Format_ARGB32_Premultiplied);
+	Assert(img.format() == QImage::Format_ARGB32_Premultiplied);
 
 	uint64 components[3] = { 0 };
 	uint64 componentsScroll[3] = { 0 };
@@ -430,7 +430,7 @@ void ChatBackground::setImage(int32 id, QImage &&image) {
 		Local::writeBackground(_id, (_id == kDefaultBackground || _id == kInitialBackground) ? QImage() : image);
 		setPreparedImage(prepareBackgroundImage(std::move(image)));
 	}
-	t_assert(!_pixmap.isNull() && !_pixmapForTiled.isNull());
+	Assert(!_pixmap.isNull() && !_pixmapForTiled.isNull());
 	notify(BackgroundUpdate(BackgroundUpdate::Type::New, _tile));
 	if (resetPalette) {
 		notify(BackgroundUpdate(BackgroundUpdate::Type::TestingTheme, _tile), true);
@@ -474,7 +474,7 @@ void ChatBackground::setPreparedImage(QImage &&image) {
 
 	auto width = image.width();
 	auto height = image.height();
-	t_assert(width > 0 && height > 0);
+	Assert(width > 0 && height > 0);
 	auto isSmallForTiled = (width < kMinimumTiledSize || height < kMinimumTiledSize);
 	if (isSmallForTiled) {
 		auto repeatTimesX = qCeil(kMinimumTiledSize / float64(width));
diff --git a/Telegram/SourceFiles/window/themes/window_theme_editor.cpp b/Telegram/SourceFiles/window/themes/window_theme_editor.cpp
index 433945534..60c1c89ae 100644
--- a/Telegram/SourceFiles/window/themes/window_theme_editor.cpp
+++ b/Telegram/SourceFiles/window/themes/window_theme_editor.cpp
@@ -436,7 +436,7 @@ bool Editor::Inner::readData() {
 		if (!_existingRows->feedDescription(name, description)) {
 			if (row.value.data()[0] == '#') {
 				auto result = readColor(name, row.value.data() + 1, row.value.size() - 1);
-				t_assert(!result.error);
+				Assert(!result.error);
 				_newRows->feed(name, result.color);
 				//if (!_newRows->feedFallbackName(name, str_const_toString(row.fallback))) {
 				//	Unexpected("Row for fallback not found");
@@ -448,7 +448,7 @@ bool Editor::Inner::readData() {
 				} else if (!_newRows->feedCopy(name, copyOf)) {
 					Unexpected("Copy of unknown value in the default palette");
 				}
-				t_assert(row.fallback.size() == 0);
+				Assert(row.fallback.size() == 0);
 			}
 			if (!_newRows->feedDescription(name, description)) {
 				Unexpected("Row for description not found");
diff --git a/Telegram/SourceFiles/window/themes/window_theme_editor_block.cpp b/Telegram/SourceFiles/window/themes/window_theme_editor_block.cpp
index aa097d8a5..00cc5d0b2 100644
--- a/Telegram/SourceFiles/window/themes/window_theme_editor_block.cpp
+++ b/Telegram/SourceFiles/window/themes/window_theme_editor_block.cpp
@@ -192,7 +192,7 @@ EditorBlock::EditorBlock(QWidget *parent, Type type, Context *context) : TWidget
 			feedDescription(name, added.description);
 
 			auto row = findRow(name);
-			t_assert(row != nullptr);
+			Assert(row != nullptr);
 			auto possibleCopyOf = added.possibleCopyOf;
 			auto copyOf = checkCopyOf(findRowIndex(row), possibleCopyOf) ? possibleCopyOf : QString();
 			removeFromSearch(*row);
@@ -238,7 +238,7 @@ bool EditorBlock::feedCopy(const QString &name, const QString &copyOf) {
 
 void EditorBlock::removeRow(const QString &name, bool removeCopyReferences) {
 	auto it = _indices.find(name);
-	t_assert(it != _indices.cend());
+	Assert(it != _indices.cend());
 
 	auto index = it.value();
 	for (auto i = index + 1, count = static_cast<int>(_data.size()); i != count; ++i) {
diff --git a/Telegram/gyp/telegram_sources.txt b/Telegram/gyp/telegram_sources.txt
index a45a9100a..1a8d313f5 100644
--- a/Telegram/gyp/telegram_sources.txt
+++ b/Telegram/gyp/telegram_sources.txt
@@ -1,4 +1,5 @@
 <(src_loc)/base/algorithm.h
+<(src_loc)/base/assertion.h
 <(src_loc)/base/build_config.h
 <(src_loc)/base/flat_map.h
 <(src_loc)/base/flat_set.h