fix crash problem

This commit is contained in:
秦宇航
2017-07-24 07:52:20 +08:00
parent ac027b8588
commit 5ce8e611e2
2 changed files with 7 additions and 10 deletions
+1 -1
View File
@@ -199,7 +199,7 @@ class AppDelegate: NSObject, NSApplicationDelegate, NSUserNotificationCenterDele
ProxyConfHelper.install()
applyConfig()
SyncSSLocal()
// SyncSSLocal()
if defaults.bool(forKey: "ConnectAtLaunch") && ServerProfileManager.instance.getActiveProfileId() != "" {
toggleRunning(toggleRunningMenuItem)
+6 -9
View File
@@ -74,7 +74,7 @@ class ServerProfileManager: NSObject {
}
if getActiveProfileId() != "" {
defaults.set(activeProfileId, forKey: "ActiveServerProfileId")
defaults.set(getActiveProfileId(), forKey: "ActiveServerProfileId")
let _ = writeSSLocalConfFile((getActiveProfile()?.toJsonConfig())!)
} else {
defaults.removeObject(forKey: "ActiveServerProfileId")
@@ -83,16 +83,13 @@ class ServerProfileManager: NSObject {
}
func getActiveProfile() -> ServerProfile? {
if let id = activeProfileId {
for p in profiles {
if p.uuid == id {
return p
}
if getActiveProfileId() == "" { return nil }
for p in profiles {
if p.uuid == getActiveProfileId() {
return p
}
return nil
} else {
return nil
}
return nil
}
func isExisted(profile: ServerProfile) -> (Bool, Int){