From 149ca9aa4cf030571796d9846574d63027ae3b3d Mon Sep 17 00:00:00 2001 From: "Ilya.Kazakevich" Date: Sat, 23 Nov 2024 19:57:26 +0100 Subject: [PATCH] Python: Do not break interpreter widget if certain python is broken. `versionString` might be `null` if python in severe broken. Such pythons shouldn't be here, and we will fix it as soon as we introduce PythonInterpreterService (cherry picked from commit d4658e07833d6f886991e794f90e5a16f28e50c3) IJ-CR-150093 GitOrigin-RevId: e0fe53bdacbd014afa67115c9c9414a0cba9ba59 --- python/src/com/jetbrains/python/sdk/add/v2/uiUtils.kt | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/python/src/com/jetbrains/python/sdk/add/v2/uiUtils.kt b/python/src/com/jetbrains/python/sdk/add/v2/uiUtils.kt index 3483a7828610..5fa2c7a5e616 100644 --- a/python/src/com/jetbrains/python/sdk/add/v2/uiUtils.kt +++ b/python/src/com/jetbrains/python/sdk/add/v2/uiUtils.kt @@ -157,7 +157,9 @@ internal fun SimpleColoredComponent.customizeForPythonInterpreter(interpreter: P } is ExistingSelectableInterpreter -> { icon = PythonPsiApiIcons.Python - append(interpreter.sdk.versionString!!) + // This is a dirty hack, but version string might be null for invalid pythons + // We must fix it after PythonInterpreterService will make sdk needless + append(interpreter.sdk.versionString ?: "broken interpreter") append(" " + replaceHomePathToTilde(interpreter.homePath), SimpleTextAttributes.GRAYED_SMALL_ATTRIBUTES) } }