QTfrontend/ui/widget/teamselect.cpp
changeset 10248 7b9b44a051f8
parent 10108 c68cf030eded
child 11046 47a8c19ecb60
--- a/QTfrontend/ui/widget/teamselect.cpp	Fri May 23 13:37:34 2014 +0400
+++ b/QTfrontend/ui/widget/teamselect.cpp	Wed May 28 09:05:36 2014 +0400
@@ -121,26 +121,22 @@
 void TeamSelWidget::removeNetTeam(const HWTeam& team)
 {
     //qDebug() << QString("removeNetTeam: removing team '%1'").arg(team.TeamName);
-    for(;;)
+    QList<HWTeam>::iterator itPlay=std::find(curPlayingTeams.begin(), curPlayingTeams.end(), team);
+    if(itPlay==curPlayingTeams.end())
     {
-        QList<HWTeam>::iterator itPlay=std::find(curPlayingTeams.begin(), curPlayingTeams.end(), team);
-        if(itPlay==curPlayingTeams.end())
-        {
-            qWarning() << QString("removeNetTeam: team '%1' not found").arg(team.name());
-            break;
-        }
-        if(itPlay->isNetTeam())
-        {
-            QObject::disconnect(framePlaying->getTeamWidget(*itPlay), SIGNAL(teamStatusChanged(HWTeam)));
-            framePlaying->removeTeam(team);
-            curPlayingTeams.erase(itPlay);
-            break;
-        }
-        else
-        {
-            qWarning() << QString("removeNetTeam: team '%1' was actually a local team!").arg(team.name());
-            break;
-        }
+        qWarning() << QString("removeNetTeam: team '%1' not found").arg(team.name());
+        return;
+    }
+
+    if(itPlay->isNetTeam())
+    {
+        QObject::disconnect(framePlaying->getTeamWidget(*itPlay), SIGNAL(teamStatusChanged(HWTeam)));
+        framePlaying->removeTeam(team);
+        curPlayingTeams.erase(itPlay);
+    }
+    else
+    {
+        qWarning() << QString("removeNetTeam: team '%1' was actually a local team!").arg(team.name());
     }
     emit setEnabledGameStart(curPlayingTeams.size()>1);
 }