fix: crash when selecting/closing file (fixes #1498) (#1507)

This commit is contained in:
Vivek Kumar Sahani
2023-12-01 19:01:25 +05:30
committed by GitHub
parent 8ac221c834
commit 1f3800697c
2 changed files with 3 additions and 5 deletions
@@ -183,7 +183,7 @@ interface ActionItem {
}
fun forId(id: String): Location {
return values().first { it.id == id }
return entries.first { it.id == id }
}
}
}
@@ -348,10 +348,8 @@ open class EditorHandlerActivity : ProjectHandlerActivity(), IEditorHandler {
override fun getEditorForFile(file: File): CodeEditorView? {
for (i in 0 until editorViewModel.getOpenedFileCount()) {
val editor = binding.editorContainer.getChildAt(i) as CodeEditorView
if (file == editor.file) {
return editor
}
val editor = binding.editorContainer.getChildAt(i) as? CodeEditorView
if (file == editor?.file) return editor
}
return null
}