Skip to content

Commit

Permalink
fix: Possible NPE when looking for an editor
Browse files Browse the repository at this point in the history
  • Loading branch information
bric3 committed Sep 14, 2021
1 parent e27c365 commit 1813f84
Showing 1 changed file with 1 addition and 1 deletion.
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,7 @@ val debugMode = ProcessHandle.current().info().arguments().map {
*/
fun AnActionEvent.findEditor(): ExcalidrawEditor? {
val project = this.project ?: return null
val psiFile = (this.dataContext.getData(CommonDataKeys.PSI_FILE) as PsiFile)
val psiFile = this.dataContext.getData(CommonDataKeys.PSI_FILE) ?: return null
val editor = FileEditorManager.getInstance(project).selectedEditors.find {
psiFile.virtualFile.equals(it.file)
}
Expand Down

0 comments on commit 1813f84

Please sign in to comment.