diff --git a/app/src/main/java/com/github/libretube/ui/preferences/InstanceSettings.kt b/app/src/main/java/com/github/libretube/ui/preferences/InstanceSettings.kt index 7696e8fe1..0c34906fb 100644 --- a/app/src/main/java/com/github/libretube/ui/preferences/InstanceSettings.kt +++ b/app/src/main/java/com/github/libretube/ui/preferences/InstanceSettings.kt @@ -165,12 +165,14 @@ class InstanceSettings : BasePreferenceFragment() { // fetch official public instances val response = try { - RetrofitInstance.externalApi.getInstances() + RetrofitInstance.externalApi.getInstances().toMutableList() } catch (e: Exception) { e.printStackTrace() - emptyList() + mutableListOf() } + response.sortBy { it.name } + response.forEach { if (it.name != null && it.api_url != null) { instanceNames += it.name!!