summaryrefslogtreecommitdiffhomepage
path: root/ios
diff options
context:
space:
mode:
authorJon Petersson <jon.petersson@kvadrat.se>2024-03-05 16:29:22 +0100
committerJon Petersson <jon.petersson@kvadrat.se>2024-03-05 16:29:22 +0100
commite5569a98940a3d8327b6c782fff0dbfda2bbdf51 (patch)
tree42d76cf67c55dffea894479cdd168a501018693a /ios
parentba74cacee82f8b75bd59f2672fa4eca4c0c26235 (diff)
downloadmullvadvpn-e5569a98940a3d8327b6c782fff0dbfda2bbdf51.tar.xz
mullvadvpn-e5569a98940a3d8327b6c782fff0dbfda2bbdf51.zip
Fix bug where location list is empty on release build
Diffstat (limited to 'ios')
-rw-r--r--ios/MullvadVPN/View controllers/SelectLocation/LocationDataSource.swift18
1 files changed, 9 insertions, 9 deletions
diff --git a/ios/MullvadVPN/View controllers/SelectLocation/LocationDataSource.swift b/ios/MullvadVPN/View controllers/SelectLocation/LocationDataSource.swift
index 449c8bd61e..34b78737a7 100644
--- a/ios/MullvadVPN/View controllers/SelectLocation/LocationDataSource.swift
+++ b/ios/MullvadVPN/View controllers/SelectLocation/LocationDataSource.swift
@@ -51,28 +51,28 @@ final class LocationDataSource: UITableViewDiffableDataSource<LocationSection, L
}
func setRelays(_ response: REST.ServerRelaysResponse, selectedLocations: RelayLocations?, filter: RelayFilter) {
- guard let customListsDataSource =
- dataSources.first(where: { $0 is CustomListsDataSource }) as? CustomListsDataSource,
- let allLocationsDataSource =
+ let allLocationsDataSource =
dataSources.first(where: { $0 is AllLocationDataSource }) as? AllLocationDataSource
- else { return }
+
+ let customListsDataSource =
+ dataSources.first(where: { $0 is CustomListsDataSource }) as? CustomListsDataSource
let relays = response.wireguard.relays.filter { relay in
RelaySelector.relayMatchesFilter(relay, filter: filter)
}
- allLocationsDataSource.reload(response, relays: relays)
- customListsDataSource.reload(allLocationNodes: allLocationsDataSource.nodes)
+ allLocationsDataSource?.reload(response, relays: relays)
+ customListsDataSource?.reload(allLocationNodes: allLocationsDataSource?.nodes ?? [])
if let selectedLocations {
// Look for a matching custom list node.
if let customListId = selectedLocations.customListId,
- let customList = customListsDataSource.customList(by: customListId),
- let selectedNode = customListsDataSource.node(by: selectedLocations.locations, for: customList) {
+ let customList = customListsDataSource?.customList(by: customListId),
+ let selectedNode = customListsDataSource?.node(by: selectedLocations.locations, for: customList) {
selectedItem = LocationCellViewModel(section: .customLists, node: selectedNode)
// Look for a matching all locations node.
} else if let location = selectedLocations.locations.first,
- let selectedNode = allLocationsDataSource.node(by: location) {
+ let selectedNode = allLocationsDataSource?.node(by: location) {
selectedItem = LocationCellViewModel(section: .allLocations, node: selectedNode)
}
}