diff --git a/src/formatter.ts b/src/formatter.ts index 272485b..f67bf9c 100644 --- a/src/formatter.ts +++ b/src/formatter.ts @@ -98,7 +98,7 @@ export class JupyterlabNotebookCodeFormatter extends JupyterlabCodeFormatter { } const metadata = - this.notebookTracker.currentWidget.content.model!.sharedModel.metadata; + this.notebookTracker.currentWidget.content.model?.sharedModel?.metadata; if (!metadata) { return null;