Add null protection.
I was getting "extension could not load error" on starting up obsidian. This was because of leaf not being its expected value.
This commit is contained in:
parent
9e6550f407
commit
29766d2fe6
1 changed files with 1 additions and 1 deletions
|
@ -72,7 +72,7 @@ export default class BetterWordCount extends Plugin {
|
|||
|
||||
giveEditorPlugin(leaf: WorkspaceLeaf): void {
|
||||
//@ts-expect-error, not typed
|
||||
const editor = leaf.view.editor;
|
||||
const editor = leaf?.view?.editor;
|
||||
if (editor) {
|
||||
const editorView = editor.cm as EditorView;
|
||||
const editorPlug = editorView.plugin(editorPlugin);
|
||||
|
|
Loading…
Reference in a new issue