From e8c6c35936605bd40a0a61e8689e1fb415ad774a Mon Sep 17 00:00:00 2001
From: Kevin Smith <git@kismith.co.uk>
Date: Fri, 14 Jan 2011 19:33:57 +0000
Subject: Don't crash when reconnecting with open Chats.

Resolves: #740

diff --git a/Swift/Controllers/Chat/ChatController.cpp b/Swift/Controllers/Chat/ChatController.cpp
index e4a76fa..3fffbb1 100644
--- a/Swift/Controllers/Chat/ChatController.cpp
+++ b/Swift/Controllers/Chat/ChatController.cpp
@@ -180,6 +180,10 @@ void ChatController::handlePresenceChange(boost::shared_ptr<Presence> newPresenc
 	if (!me) {
 		return;
 	}
+	if (!newPresence) {
+		newPresence = boost::shared_ptr<Presence>(new Presence());
+		newPresence->setType(Presence::Unavailable);
+	}
 	lastShownStatus_ = newPresence->getShow();
 
 	chatStateTracker_->handlePresenceChange(newPresence);
-- 
cgit v0.10.2-6-g49f6