Commit 824bc87a authored by Daniel Wolf's avatar Daniel Wolf
Browse files

Fix app crashing when input/output streams were not created at all

parent 1068ddb5
......@@ -245,12 +245,17 @@ class DnsSpeedTest(context:Context,
return null
}
} catch (ex:Throwable) {
log("Request to failed: $ex")
return null
} finally {
connection?.disconnect()
if(wasEstablished) {
connection?.inputStream?.closeSilently()
connection?.outputStream?.closeSilently()
try {
connection?.inputStream?.closeSilently()
connection?.outputStream?.closeSilently()
} catch (ex: java.lang.Exception) {
log("Could not close streams of failed request: $ex")
}
}
}
}
......
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