From b23f4fb9bee49f93bbba6a9039f0f764664125cd Mon Sep 17 00:00:00 2001
From: Kevin Smith <git@kismith.co.uk>
Date: Fri, 14 Nov 2014 19:42:00 +0000
Subject: Don't crash when the UI doesn't provide a user search window

Change-Id: I9c8692e0c4f36877591385a7580cb8a2107bd68f

diff --git a/Swift/Controllers/Chat/UserSearchController.cpp b/Swift/Controllers/Chat/UserSearchController.cpp
index 53898a1..24f3724 100644
--- a/Swift/Controllers/Chat/UserSearchController.cpp
+++ b/Swift/Controllers/Chat/UserSearchController.cpp
@@ -65,7 +65,9 @@ void UserSearchController::setCanInitiateImpromptuMUC(bool supportsImpromptu) {
 	if (!window_) {
 		initializeUserWindow();
 	}
-	window_->setCanStartImpromptuChats(supportsImpromptu);
+	if (window_) {
+		window_->setCanStartImpromptuChats(supportsImpromptu);
+	} // Else doesn't support search
 }
 
 void UserSearchController::handleUIEvent(boost::shared_ptr<UIEvent> event) {
@@ -323,6 +325,10 @@ void UserSearchController::initializeUserWindow() {
 		}
 
 		window_ = factory_->createUserSearchWindow(windowType, uiEventStream_, rosterController_->getGroups());
+		if (!window_) {
+			// UI Doesn't support user search
+			return;
+		}
 		window_->onNameSuggestionRequested.connect(boost::bind(&UserSearchController::handleNameSuggestionRequest, this, _1));
 		window_->onFormRequested.connect(boost::bind(&UserSearchController::handleFormRequested, this, _1));
 		window_->onSearchRequested.connect(boost::bind(&UserSearchController::handleSearch, this, _1, _2));
-- 
cgit v0.10.2-6-g49f6