diff options
author | Petr Mrázek <peterix@gmail.com> | 2015-09-30 00:11:00 +0200 |
---|---|---|
committer | Petr Mrázek <peterix@gmail.com> | 2015-09-30 00:11:00 +0200 |
commit | e2fd299fc588962b19b91d3e11f7bf274080de84 (patch) | |
tree | ec3ac3be97edfc42976847ceb50fd8adf4cf1fd2 /logic | |
parent | e993b1152df6ba7ca343e66263f2860e4c4ecee6 (diff) | |
download | MultiMC-e2fd299fc588962b19b91d3e11f7bf274080de84.tar MultiMC-e2fd299fc588962b19b91d3e11f7bf274080de84.tar.gz MultiMC-e2fd299fc588962b19b91d3e11f7bf274080de84.tar.lz MultiMC-e2fd299fc588962b19b91d3e11f7bf274080de84.tar.xz MultiMC-e2fd299fc588962b19b91d3e11f7bf274080de84.zip |
GH-253 implement launching instances from command line
Diffstat (limited to 'logic')
-rw-r--r-- | logic/InstanceList.cpp | 19 |
1 files changed, 6 insertions, 13 deletions
diff --git a/logic/InstanceList.cpp b/logic/InstanceList.cpp index 2ff0c913..22b36748 100644 --- a/logic/InstanceList.cpp +++ b/logic/InstanceList.cpp @@ -362,23 +362,16 @@ int InstanceList::add(InstancePtr t) InstancePtr InstanceList::getInstanceById(QString instId) const { - if (m_instances.isEmpty()) - { + if(instId.isEmpty()) return InstancePtr(); - } - - QListIterator<InstancePtr> iter(m_instances); - InstancePtr inst; - while (iter.hasNext()) + for(auto & inst: m_instances) { - inst = iter.next(); if (inst->id() == instId) - break; + { + return inst; + } } - if (inst->id() != instId) - return InstancePtr(); - else - return iter.peekPrevious(); + return InstancePtr(); } QModelIndex InstanceList::getInstanceIndexById(const QString &id) const |