mirror of
https://github.com/passepartoutvpn/passepartout-apple.git
synced 2025-01-18 22:49:10 +00:00
Ignore non-existing active profile
This commit is contained in:
parent
472b5e4b41
commit
acbc1980f9
@ -139,8 +139,7 @@ class AppContext {
|
||||
profileManager.observeUpdates()
|
||||
vpnManager.observeUpdates()
|
||||
|
||||
if let activeProfileId = appManager.activeProfileId {
|
||||
profileManager.setActiveProfileId(activeProfileId)
|
||||
if let activeProfileId = appManager.activeProfileId, profileManager.setActiveProfileId(activeProfileId) {
|
||||
do {
|
||||
try profileManager.loadCurrentProfile(withId: activeProfileId)
|
||||
} catch {
|
||||
|
@ -86,8 +86,13 @@ public class ProfileManager: ObservableObject {
|
||||
currentProfile = ObservableProfile()
|
||||
}
|
||||
|
||||
public func setActiveProfileId(_ id: UUID) {
|
||||
public func setActiveProfileId(_ id: UUID) -> Bool {
|
||||
guard isExistingProfile(withId: id) else {
|
||||
pp_log.warning("Active profile \(id) does not exist, ignoring")
|
||||
return false
|
||||
}
|
||||
activeProfileId = id
|
||||
return true
|
||||
}
|
||||
}
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user