From 3e6c0690fb2ac402fbee08a31e2d4e7b1f4fd0ec Mon Sep 17 00:00:00 2001
From: Emmanuel Lepage Vallee <elv1313@gmail.com>
Date: Tue, 5 Jan 2016 19:42:26 -0500
Subject: [PATCH] account: Fix infinite loop

A little tested feature had a clear infinite loop, but it is used by
no client by default, the KDE client still has an option to enable
the manual account selection.

Change-Id: I60c78a86f93beebd0c397c964bfee26591eca0a7
---
 src/availableaccountmodel.cpp | 3 ++-
 1 file changed, 2 insertions(+), 1 deletion(-)

diff --git a/src/availableaccountmodel.cpp b/src/availableaccountmodel.cpp
index e45b9bd2..576756d2 100644
--- a/src/availableaccountmodel.cpp
+++ b/src/availableaccountmodel.cpp
@@ -159,7 +159,8 @@ void AvailableAccountModelPrivate::setPriorAccount(const Account* account)
    m_spPriorAccount = const_cast<Account*>(account);
    if (changed) {
       auto& self = AvailableAccountModel::instance();
-      Account* a = self.currentDefaultAccount();
+
+      Account* a = account ? const_cast<Account*>(account) : self.currentDefaultAccount();
 
       emit self.currentDefaultAccountChanged(a);
 
-- 
GitLab