Skip to content

Commit b90afeb

Browse files
committed
Merge branch 'fix-bug-where-location-list-is-empty-on-release-build-ios-543'
2 parents ba74cac + e5569a9 commit b90afeb

File tree

1 file changed

+9
-9
lines changed

1 file changed

+9
-9
lines changed

ios/MullvadVPN/View controllers/SelectLocation/LocationDataSource.swift

+9-9
Original file line numberDiff line numberDiff line change
@@ -51,28 +51,28 @@ final class LocationDataSource: UITableViewDiffableDataSource<LocationSection, L
5151
}
5252

5353
func setRelays(_ response: REST.ServerRelaysResponse, selectedLocations: RelayLocations?, filter: RelayFilter) {
54-
guard let customListsDataSource =
55-
dataSources.first(where: { $0 is CustomListsDataSource }) as? CustomListsDataSource,
56-
let allLocationsDataSource =
54+
let allLocationsDataSource =
5755
dataSources.first(where: { $0 is AllLocationDataSource }) as? AllLocationDataSource
58-
else { return }
56+
57+
let customListsDataSource =
58+
dataSources.first(where: { $0 is CustomListsDataSource }) as? CustomListsDataSource
5959

6060
let relays = response.wireguard.relays.filter { relay in
6161
RelaySelector.relayMatchesFilter(relay, filter: filter)
6262
}
6363

64-
allLocationsDataSource.reload(response, relays: relays)
65-
customListsDataSource.reload(allLocationNodes: allLocationsDataSource.nodes)
64+
allLocationsDataSource?.reload(response, relays: relays)
65+
customListsDataSource?.reload(allLocationNodes: allLocationsDataSource?.nodes ?? [])
6666

6767
if let selectedLocations {
6868
// Look for a matching custom list node.
6969
if let customListId = selectedLocations.customListId,
70-
let customList = customListsDataSource.customList(by: customListId),
71-
let selectedNode = customListsDataSource.node(by: selectedLocations.locations, for: customList) {
70+
let customList = customListsDataSource?.customList(by: customListId),
71+
let selectedNode = customListsDataSource?.node(by: selectedLocations.locations, for: customList) {
7272
selectedItem = LocationCellViewModel(section: .customLists, node: selectedNode)
7373
// Look for a matching all locations node.
7474
} else if let location = selectedLocations.locations.first,
75-
let selectedNode = allLocationsDataSource.node(by: location) {
75+
let selectedNode = allLocationsDataSource?.node(by: location) {
7676
selectedItem = LocationCellViewModel(section: .allLocations, node: selectedNode)
7777
}
7878
}

0 commit comments

Comments
 (0)