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