1
0
Fork 0
mirror of https://github.com/ethauvin/kobalt.git synced 2025-04-26 08:27:12 -07:00

Github API fix.

This commit is contained in:
Cedric Beust 2016-04-07 06:23:43 -08:00
parent fd2c9a932f
commit 1a58b70a8e

View file

@ -117,14 +117,17 @@ class GithubApi2 @Inject constructor(
} else {
service.getReleasesNoAuth("cbeust", "kobalt")
}
val releases = req.execute()
.body()
releases.firstOrNull()?.let {
try {
result = listOf(it.name, it.tagName).filterNotNull().first { !it.isBlank() }
} catch(ex: NoSuchElementException) {
throw KobaltException("Couldn't find the latest release")
val releases = req.execute().body()
if (releases != null) {
releases.firstOrNull()?.let {
try {
result = listOf(it.name, it.tagName).filterNotNull().first { !it.isBlank() }
} catch(ex: NoSuchElementException) {
throw KobaltException("Couldn't find the latest release")
}
}
} else {
warn("Didn't receive any body in the response to GitHub.getReleases()")
}
} catch(e: Exception) {
log(1, "Couldn't retrieve releases from github: " + e.message)