Skip to content

Commit 3b43432

Browse files
committed
movePrev getActiveTextEditor may return undefined
1 parent 5fa1709 commit 3b43432

File tree

1 file changed

+7
-3
lines changed

1 file changed

+7
-3
lines changed

lib_src/misc/cells.ts

Lines changed: 7 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -102,10 +102,14 @@ export function movePrev(editor: TextEditor | undefined | null) {
102102
if (!editor) {
103103
editor = atom.workspace.getActiveTextEditor()
104104
}
105-
if (editor.getGrammar().scopeName.indexOf("source.weave") > -1) {
106-
return weaveMovePrev(editor)
105+
if (editor) {
106+
if (editor.getGrammar().scopeName.indexOf("source.weave") > -1) {
107+
return weaveMovePrev(editor)
108+
} else {
109+
return jlMovePrev(editor)
110+
}
107111
} else {
108-
return jlMovePrev(editor)
112+
console.error("No editor is given")
109113
}
110114
}
111115

0 commit comments

Comments
 (0)