Skip to content

Commit

Permalink
Don't crash if ApolloDebugServerInitializer is not run (e.g. in unit …
Browse files Browse the repository at this point in the history
…tests) (#5484)
  • Loading branch information
BoD committed Dec 15, 2023
1 parent 192b91e commit ed21a52
Show file tree
Hide file tree
Showing 2 changed files with 3 additions and 2 deletions.
Expand Up @@ -11,6 +11,6 @@ internal class ApolloDebugServerInitializer : Initializer<Unit> {
override fun dependencies(): List<Class<out Initializer<*>>> = emptyList()

companion object {
lateinit var packageName: String
var packageName: String? = null
}
}
Expand Up @@ -35,7 +35,8 @@ private class AndroidServer(

override fun start() {
if (localServerSocket != null) error("Already started")
val localServerSocket = LocalServerSocket("$SOCKET_NAME_PREFIX${ApolloDebugServerInitializer.packageName}")
val packageName = ApolloDebugServerInitializer.packageName ?: "unknown.${System.currentTimeMillis()}"
val localServerSocket = LocalServerSocket("$SOCKET_NAME_PREFIX$packageName")
this.localServerSocket = localServerSocket
coroutineScope.launch {
while (true) {
Expand Down

0 comments on commit ed21a52

Please sign in to comment.