Fixed potential resource leak
This commit is contained in:
parent
d2389088ac
commit
ac94ac7d29
1 changed files with 4 additions and 2 deletions
|
@ -56,9 +56,11 @@ class Isgd private constructor() {
|
|||
"Mozilla/5.0 (X11; Linux x86_64; rv:109.0) Gecko/20100101 Firefox/109.0"
|
||||
)
|
||||
if (connection.responseCode in 200..399) {
|
||||
return connection.inputStream.bufferedReader().readText()
|
||||
return connection.inputStream.bufferedReader().use { it.readText() }
|
||||
} else {
|
||||
throw IsgdException(connection.responseCode, connection.errorStream.bufferedReader().readText())
|
||||
throw IsgdException(
|
||||
connection.responseCode,
|
||||
connection.errorStream.bufferedReader().use { it.readText() })
|
||||
}
|
||||
}
|
||||
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue