@@ -35,6 +35,7 @@ import com.intellij.ui.components.JBPanel
3535import com.intellij.ui.components.JBTabbedPane
3636import com.intellij.ui.content.ContentFactory
3737import com.intellij.ui.table.JBTable
38+ import com.jetbrains.rd.util.printlnError
3839import git4idea.GitLocalBranch
3940import git4idea.repo.GitRepository
4041import git4idea.repo.GitRepositoryChangeListener
@@ -473,7 +474,12 @@ class SarifViewerWindowFactory : ToolWindowFactory {
473474 defaultTableModel.addRow(arrayOf<Any >(" Rule's name" , currentLeaf!! .ruleName))
474475 defaultTableModel.addRow(arrayOf<Any >(" Rule's description" , currentLeaf!! .ruleDescription))
475476 defaultTableModel.addRow(arrayOf<Any >(" Location" , currentLeaf!! .location))
476- defaultTableModel.addRow(arrayOf<Any >(" GitHub alert number" , currentLeaf!! .githubAlertNumber))
477+ defaultTableModel.addRow(
478+ arrayOf<Any >(
479+ " GitHub alert number" ,
480+ currentLeaf!! .githubAlertNumber
481+ )
482+ )
477483 defaultTableModel.addRow(
478484 arrayOf<Any >(
479485 " GitHub alert url" ,
@@ -537,8 +543,11 @@ class SarifViewerWindowFactory : ToolWindowFactory {
537543 tableSteps.addMouseListener(object : MouseAdapter () {
538544 override fun mouseClicked (e : MouseEvent ) {
539545 val row = tableInfos.rowAtPoint(e.point)
540- val path = currentLeaf!! .steps[row].split(" :" )
541- openFile(project, path[0 ], path[1 ].toInt(), path[2 ].toInt())
546+ // When the row can't be found, the method returns -1
547+ if (row != - 1 ) {
548+ val path = currentLeaf!! .steps[row].split(" :" )
549+ openFile(project, path[0 ], path[1 ].toInt(), path[2 ].toInt())
550+ }
542551 }
543552 })
544553
@@ -585,7 +594,8 @@ class SarifViewerWindowFactory : ToolWindowFactory {
585594 val editor: Editor = FileEditorManager .getInstance(project).selectedTextEditor ? : return
586595 val inlayModel = editor.inlayModel
587596
588- inlayModel.getBlockElementsInRange(0 , editor.document.textLength).filter { it.renderer is MyCustomInlayRenderer }
597+ inlayModel.getBlockElementsInRange(0 , editor.document.textLength)
598+ .filter { it.renderer is MyCustomInlayRenderer }
589599 .forEach { it.dispose() }
590600
591601 val virtualFile =
@@ -619,11 +629,12 @@ class SarifViewerWindowFactory : ToolWindowFactory {
619629 // display error message
620630 Notifications .Bus .notify(
621631 Notification (
622- " Sarif viewer" ,
623- " File not found" ,
624- " Can't find the file ${project.basePath} /$path " ,
625- NotificationType .WARNING
626- ), project)
632+ " Sarif viewer" ,
633+ " File not found" ,
634+ " Can't find the file ${project.basePath} /$path " ,
635+ NotificationType .WARNING
636+ ), project
637+ )
627638 }
628639 }
629640
0 commit comments