mirror of
https://github.com/qinyuhang/ShadowsocksX-NG-R.git
synced 2026-10-30 13:43:45 +00:00
fix crash problem
This commit is contained in:
@@ -199,7 +199,7 @@ class AppDelegate: NSObject, NSApplicationDelegate, NSUserNotificationCenterDele
|
||||
|
||||
ProxyConfHelper.install()
|
||||
applyConfig()
|
||||
SyncSSLocal()
|
||||
// SyncSSLocal()
|
||||
|
||||
if defaults.bool(forKey: "ConnectAtLaunch") && ServerProfileManager.instance.getActiveProfileId() != "" {
|
||||
toggleRunning(toggleRunningMenuItem)
|
||||
|
||||
@@ -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){
|
||||
|
||||
Reference in New Issue
Block a user