瀏覽代碼

Small fix on serverlist

Mihawk 12 年之前
父節點
當前提交
00f90c4751
共有 1 個文件被更改,包括 14 次插入3 次删除
  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();