Fix NPE starting IDE Repl Console

consoleView field is initialized in initAndRun inside invokeLaterIfNeeded call.
This may cause NPE in setupGutters if consoleView isn't initialized yet
^KT-29400 Fixed
This commit is contained in:
Natalia Selezneva
2019-01-22 12:46:36 +03:00
parent 0548454581
commit 85bd729715
2 changed files with 3 additions and 3 deletions
@@ -48,8 +48,6 @@ class KotlinConsoleKeeper(val project: Project) {
val consoleRunner = KotlinConsoleRunner(module, cmdLine, previousCompilationFailed, project, REPL_TITLE, path)
consoleRunner.initAndRun()
consoleRunner.setupGutters()
return consoleRunner
}
@@ -168,6 +168,8 @@ class KotlinConsoleRunner(
enableCompletion(consoleView)
setupGutters(consoleView)
return consoleView
}
@@ -228,7 +230,7 @@ class KotlinConsoleRunner(
editor.setPlaceholderAttributes(placeholderAttrs)
}
fun setupGutters() {
fun setupGutters(consoleView: LanguageConsoleView) {
fun configureEditorGutter(editor: EditorEx, color: Color, iconWithTooltip: IconWithTooltip): RangeHighlighter {
editor.settings.isLineMarkerAreaShown = true // hack to show gutter
editor.settings.isFoldingOutlineShown = true