summaryrefslogtreecommitdiffstats
path: root/logic/lists
diff options
context:
space:
mode:
Diffstat (limited to 'logic/lists')
-rw-r--r--logic/lists/MojangAccountList.cpp13
-rw-r--r--logic/lists/MojangAccountList.h1
2 files changed, 11 insertions, 3 deletions
diff --git a/logic/lists/MojangAccountList.cpp b/logic/lists/MojangAccountList.cpp
index 1d67c70f..a30ef4ab 100644
--- a/logic/lists/MojangAccountList.cpp
+++ b/logic/lists/MojangAccountList.cpp
@@ -93,9 +93,16 @@ MojangAccountPtr MojangAccountList::activeAccount() const
void MojangAccountList::setActiveAccount(const QString& username)
{
beginResetModel();
- for (MojangAccountPtr account : m_accounts)
- if (account->username() == username)
- m_activeAccount = username;
+ if (username.isEmpty())
+ {
+ m_activeAccount = "";
+ }
+ else
+ {
+ for (MojangAccountPtr account : m_accounts)
+ if (account->username() == username)
+ m_activeAccount = username;
+ }
endResetModel();
onListChanged();
}
diff --git a/logic/lists/MojangAccountList.h b/logic/lists/MojangAccountList.h
index 71f472f7..cfe96c11 100644
--- a/logic/lists/MojangAccountList.h
+++ b/logic/lists/MojangAccountList.h
@@ -122,6 +122,7 @@ public:
/*!
* Sets the given account as the current active account.
+ * If the username given is an empty string, sets the active account to nothing.
*/
virtual void setActiveAccount(const QString& username);