Skip to content

Commit

Permalink
Prøv å fange en NullPointerException fra denne informasjonen:
Browse files Browse the repository at this point in the history
Exception in thread "main" java.lang.NullPointerException: Cannot invoke "java.lang.Iterable.iterator()" because "$this$any$iv" is null
	at no.digipost.github.monitoring.GithubApiClient.hasContainerScanWorkflow(GithubApiClient.kt:67)
  • Loading branch information
eivinhb committed Sep 2, 2024
1 parent 537eb0f commit 2c333e6
Showing 1 changed file with 5 additions and 1 deletion.
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,11 @@ class GithubApiClient(private val githubToken: String) {
}

private fun hasContainerScanWorkflow(repo: Repository): Boolean {
return fetchWorkflows(repo).workflows.any { it.path.contains(SCAN_CONTAINERS_YML) }
return try {
fetchWorkflows(repo).workflows.any { it.path.contains(SCAN_CONTAINERS_YML) }
} catch (e: NullPointerException) {
false
}
}

private fun fetchWorkflows(repo: Repository): Workflows {
Expand Down

0 comments on commit 2c333e6

Please sign in to comment.