Fall back to default infrastructure preset

Fixes #57
This commit is contained in:
Davide De Rosa 2019-04-05 19:37:18 +02:00
parent 3403d0265a
commit caab7fa9bc
1 changed files with 8 additions and 1 deletions

View File

@ -263,7 +263,14 @@ public class ConnectionService: Codable {
let data = try profileData(key)
switch key.context {
case .provider:
profile = try decoder.decode(ProviderConnectionProfile.self, from: data)
let providerProfile = try decoder.decode(ProviderConnectionProfile.self, from: data)
// fix renamed presets, fall back to default
if providerProfile.preset == nil {
providerProfile.presetId = providerProfile.infrastructure.defaults.preset
}
profile = providerProfile
case .host:
let hostProfile = try decoder.decode(HostConnectionProfile.self, from: data)