File tree 2 files changed +10
-5
lines changed
ios/MullvadVPN/View controllers/SelectLocation
2 files changed +10
-5
lines changed Original file line number Diff line number Diff line change @@ -85,18 +85,21 @@ class CustomListsDataSource: LocationDataSourceProtocol {
85
85
return switch location {
86
86
case let . country( countryCode) :
87
87
rootNode
88
- . countryFor ( code: countryCode) ? . copy ( withParent: parentNode)
88
+ . countryFor ( code: countryCode) ?
89
+ . copy ( withParent: parentNode)
89
90
90
91
case let . city( countryCode, cityCode) :
91
92
rootNode
92
- . countryFor ( code: countryCode) ? . copy ( withParent: parentNode)
93
- . cityFor ( codes: [ countryCode, cityCode] )
93
+ . countryFor ( code: countryCode) ?
94
+ . cityFor ( codes: [ countryCode, cityCode] ) ?
95
+ . copy ( withParent: parentNode)
94
96
95
97
case let . hostname( countryCode, cityCode, hostCode) :
96
98
rootNode
97
- . countryFor ( code: countryCode) ? . copy ( withParent : parentNode )
99
+ . countryFor ( code: countryCode) ?
98
100
. cityFor ( codes: [ countryCode, cityCode] ) ?
99
- . hostFor ( code: hostCode)
101
+ . hostFor ( code: hostCode) ?
102
+ . copy ( withParent: parentNode)
100
103
}
101
104
}
102
105
}
Original file line number Diff line number Diff line change @@ -80,6 +80,8 @@ extension LocationNode {
80
80
}
81
81
82
82
extension LocationNode {
83
+ /// Recursively copies a node, its parent and its descendants from another
84
+ /// node (tree), with an optional custom root parent.
83
85
func copy( withParent parent: LocationNode ? = nil ) -> LocationNode {
84
86
let node = LocationNode (
85
87
name: name,
You can’t perform that action at this time.
0 commit comments