Fixed issue #6649 by checking for internet connection before starting the game if "online multiplayer" is selected

Many thanks to @SomeTroglodyte for most of the code and for explanations
This commit is contained in:
alexban011
2022-05-02 22:06:05 +03:00
parent eb65791ea7
commit f52ad60b51
2 changed files with 3 additions and 3 deletions

View File

@ -425,7 +425,7 @@ class OptionsPopup(val previousScreen: BaseScreen) : Popup(previousScreen) {
} }
for (line in modLinks) { for (line in modLinks) {
val label = Label(line.text, BaseScreen.skin) val label = Label(line.text, BaseScreen.skin)
.apply { color = line.errorSeverityToReport.color } .apply { color = line.errorSeverityToReport.color }
label.wrap = true label.wrap = true
it.add(label).width(stage.width / 2).row() it.add(label).width(stage.width / 2).row()
} }

View File

@ -9,9 +9,9 @@ class PlatformSpecificHelpersDesktop : GeneralPlatformSpecificHelpers {
} }
override fun isInternetConnected(): Boolean { override fun isInternetConnected(): Boolean {
return try{ return try {
InetAddress.getByName("8.8.8.8").isReachable(500) // Parameter timeout in milliseconds InetAddress.getByName("8.8.8.8").isReachable(500) // Parameter timeout in milliseconds
}catch (ex: Exception){ } catch (ex: Throwable) {
false false
} }
} }