diff --git a/app/src/editor/util.ts b/app/src/editor/util.ts index 1ff7da24d..f30062a43 100644 --- a/app/src/editor/util.ts +++ b/app/src/editor/util.ts @@ -276,7 +276,7 @@ export const openFile = async (options: IOpenFileOptions) => { } wnd.showHeading(); if (options.afterOpen) { - options.afterOpen(createdTab.model); + options.afterOpen(createdTab ? createdTab.model : undefined); } return createdTab; }