Skip to content

Commit

Permalink
prevent crash when there's no internet connection
Browse files Browse the repository at this point in the history
  • Loading branch information
knighthat committed Nov 3, 2024
1 parent 53e4bfc commit b89e5cb
Showing 1 changed file with 8 additions and 2 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -217,6 +217,7 @@ import okhttp3.Response
import timber.log.Timber
import java.io.File
import java.net.Proxy
import java.net.UnknownHostException
import java.util.Locale
import java.util.Objects
import kotlin.math.sqrt
Expand Down Expand Up @@ -321,8 +322,13 @@ class MainActivity :

// Fetch Piped & Invidious instances
lifecycleScope.launch( Dispatchers.IO ) {
Piped.fetchInstances()
Invidious.fetchInstances()
try {
Piped.fetchInstances()
Invidious.fetchInstances()
} catch ( _: UnknownHostException ) {
// Probably because there's no internet connection
// See report #4328
}
}
}

Expand Down

0 comments on commit b89e5cb

Please sign in to comment.