Skip to content

Commit

Permalink
More safer firsts
Browse files Browse the repository at this point in the history
  • Loading branch information
WarningImHack3r committed Sep 30, 2024
1 parent 1192cf3 commit 32381e5
Show file tree
Hide file tree
Showing 2 changed files with 3 additions and 4 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -39,7 +39,7 @@ class GitHubErrorReportSubmitter : ErrorReportSubmitter() {
): Boolean {
return try {
// Base data
val event = if (events.isNotEmpty()) events.first() else null
val event = events.firstOrNull()

val stackTrace = event?.throwableText ?: ""
val simpleErrorMessage = if (event != null && !event.message.isNullOrEmpty()) {
Expand Down Expand Up @@ -184,7 +184,7 @@ class GitHubErrorReportSubmitter : ErrorReportSubmitter() {
return IdeFocusManager.getGlobalInstance().lastFocusedFrame?.project ?: run {
val projectManager = ProjectManager.getInstance()
val openProjects = projectManager.openProjects
if (openProjects.isNotEmpty()) openProjects.first() else projectManager.defaultProject
openProjects.firstOrNull() ?: projectManager.defaultProject
}
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,6 @@ import com.intellij.ui.EditorNotificationProvider
import com.intellij.ui.EditorNotifications
import com.intellij.ui.JBColor
import com.intellij.util.applyIf
import com.jetbrains.rd.util.first
import java.util.function.Function
import javax.swing.JComponent

Expand Down Expand Up @@ -79,7 +78,7 @@ class DeprecationBanner : EditorNotificationProvider {
createActionLabel(
action.toString() + if (deprecationsCount > 1) {
" deprecations"
} else " \"${foundDeprecations.first().key}\""
} else " \"${foundDeprecations.keys.firstOrNull()}\""
) {
when (action) {
Deprecation.Action.REPLACE -> ActionsCommon.replaceAllDeprecations(psiFile)
Expand Down

0 comments on commit 32381e5

Please sign in to comment.