Skip to content

Commit 43e4cfd

Browse files
committed
fix nullpointer
1 parent ca29ed2 commit 43e4cfd

File tree

1 file changed

+3
-2
lines changed
  • kotlin-jira-client/kotlin-jira-client-sdk/src/main/kotlin/com/linkedplanet/kotlinjiraclient/sdk

1 file changed

+3
-2
lines changed

kotlin-jira-client/kotlin-jira-client-sdk/src/main/kotlin/com/linkedplanet/kotlinjiraclient/sdk/SdkJiraIssueOperator.kt

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -142,10 +142,11 @@ object SdkJiraIssueOperator : JiraIssueOperator<SdkJiraField> {
142142
}
143143

144144
private fun jiraClientError(errorCollection: ErrorCollection, errorTitle: String = "SdkError"): JiraClientError {
145-
val worstReason = Reason.getWorstReason(errorCollection.reasons)
145+
val worstReason: Reason? = Reason.getWorstReason(errorCollection.reasons)
146+
val httpStatusSuffix = worstReason?.let { " (${it.httpStatusCode})" } ?: ""
146147
return JiraClientError(
147148
errorTitle,
148-
errorCollection.errorMessages.joinToString() + " (${worstReason.httpStatusCode})"
149+
errorCollection.errorMessages.joinToString() + httpStatusSuffix
149150
)
150151
}
151152

0 commit comments

Comments
 (0)