Parcourir la source

Small fix on serverlist

Mihawk il y a 12 ans
Parent
commit
00f90c4751
1 fichiers modifiés avec 14 ajouts et 3 suppressions
  1. 14 3
      Settings.cpp

+ 14 - 3
Settings.cpp

@@ -75,9 +75,20 @@ Settings::ServerList Settings::serverList()
     ourSettings->setArrayIndex(i);
     QStringList svaddr = ourSettings->value("address").toString().split(":");
     Server sv;
-    sv.address = svaddr.at(0);
-    sv.port = svaddr.at(1).toUShort();
-    sv.supportsSendPrivate = svaddr.at(2).toInt();
+    if(svaddr.size() == 3)
+    {
+      sv.address = svaddr.at(0);
+      sv.port = svaddr.at(1).toUShort();
+      sv.supportsSendPrivate = svaddr.at(2).toInt();
+    }
+    else if(svaddr.size() == 2)
+    {
+      sv.address = svaddr.at(0);
+      sv.port = svaddr.at(1).toUShort();
+      sv.supportsSendPrivate = false;
+    }
+    else
+      continue;
     list.append(sv);
   }
   ourSettings->endArray();