catch exception for lateinit

PropertyNotInitialized exception needs catch for lateinit var
This commit is contained in:
Rurirei
2020-10-03 20:23:43 +08:00
committed by GitHub
parent e2d667e0bb
commit 3ffb2e8e05

View File

@@ -163,7 +163,13 @@ class V2RayVpnService : VpnService(), ServiceControl {
}
// Create a new interface using the builder and save the parameters.
mInterface = builder.establish()
try {
mInterface = builder.establish()!!
} catch (e: Exception) {
// non-nullable lateinit var
e.printStackTrace()
stopV2Ray()
}
}
private fun sendFd() {