Skip to content

Commit

Permalink
Merge pull request #70 from nils-a/bugfix/GH-68
Browse files Browse the repository at this point in the history
(GH-68) avoid calling data, as it might be null
  • Loading branch information
nils-a authored Jan 19, 2021
2 parents 332944d + 7f5f187 commit 90d62bf
Showing 1 changed file with 9 additions and 1 deletion.
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@ package net.cakebuild.toolwindow

import com.intellij.openapi.actionSystem.ActionGroup
import com.intellij.openapi.actionSystem.ActionManager
import com.intellij.openapi.diagnostic.Logger
import com.intellij.openapi.project.Project
import com.intellij.openapi.ui.SimpleToolWindowPanel
import com.intellij.ui.ScrollPaneFactory
Expand Down Expand Up @@ -136,6 +137,8 @@ class CakeTasksWindow(private val project: Project) : SimpleToolWindowPanel(true

class MyTreeCellRenderer : DefaultTreeCellRenderer() {

private val log = Logger.getInstance(MyTreeCellRenderer::class.java)

init {
setClosedIcon(null)
setOpenIcon(null)
Expand Down Expand Up @@ -164,7 +167,12 @@ class CakeTasksWindow(private val project: Project) : SimpleToolWindowPanel(true
label.text = data.file.nameWithoutExtension
}
else -> {
label.text = data.toString()
// do not modify the label - it's probably fine the way it is.
log.trace(
"found userObject of ${
data?.javaClass?.name ?: "[null]"
} to override the label '${label.text}'"
)
}
}
}
Expand Down

0 comments on commit 90d62bf

Please sign in to comment.