Commit 9a436271 authored by Him188's avatar Him188

Fix uninitialized vars

parent f0fbebeb
...@@ -30,9 +30,16 @@ actual class PlatformSocket : Closeable { ...@@ -30,9 +30,16 @@ actual class PlatformSocket : Closeable {
private lateinit var socket: Socket private lateinit var socket: Socket
actual val isOpen: Boolean actual val isOpen: Boolean
get() = socket.isConnected get() =
if (::socket.isInitialized)
socket.isConnected
else false
actual override fun close() = socket.close() actual override fun close() {
if (::socket.isInitialized) {
socket.close()
}
}
@PublishedApi @PublishedApi
internal lateinit var writeChannel: BufferedOutputStream internal lateinit var writeChannel: BufferedOutputStream
......
...@@ -30,7 +30,10 @@ actual class PlatformSocket : Closeable { ...@@ -30,7 +30,10 @@ actual class PlatformSocket : Closeable {
private lateinit var socket: Socket private lateinit var socket: Socket
actual val isOpen: Boolean actual val isOpen: Boolean
get() = socket.isConnected get() =
if (::socket.isInitialized)
socket.isConnected
else false
actual override fun close() { actual override fun close() {
if (::socket.isInitialized) { if (::socket.isInitialized) {
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment