From cc3828e7f77074064f92ddf306765da0780fa823 Mon Sep 17 00:00:00 2001
From: Kevin Smith <git@kismith.co.uk>
Date: Tue, 18 Oct 2011 13:39:38 +0100
Subject: Use the oldest error when closing streams.

Stops new errors overwriting cert validation errors and preventing
Swift from prompting the user to trust the cert.

diff --git a/Swiften/Client/ClientSession.cpp b/Swiften/Client/ClientSession.cpp
index 791ee75..fd001a1 100644
--- a/Swiften/Client/ClientSession.cpp
+++ b/Swiften/Client/ClientSession.cpp
@@ -420,7 +420,9 @@ void ClientSession::finishSession(Error::Type error) {
 
 void ClientSession::finishSession(boost::shared_ptr<Swift::Error> error) {
 	state = Finishing;
-	error_ = error;
+	if (!error_) {
+		error_ = error;
+	}
 	assert(stream->isOpen());
 	if (stanzaAckResponder_) {
 		stanzaAckResponder_->handleAckRequestReceived();
-- 
cgit v0.10.2-6-g49f6