浏览代码

fix file selection null error

Alexander Rose 5 年之前
父节点
当前提交
ae407248af
共有 1 个文件被更改,包括 3 次插入0 次删除
  1. 3 0
      src/structure-viewer/ui/open.tsx

+ 3 - 0
src/structure-viewer/ui/open.tsx

@@ -24,6 +24,9 @@ const OpenFileAction = StateAction.build({
     }
 })(({ params, state }, ctx: PluginContext) => Task.create('Open File', async taskCtx => {
 
+    if (params.file === null) {
+        throw new Error('no file selected')
+    }
     if (params.file.type !== 'cif' && params.file.type !== 'bcif') {
         throw new Error(`unsupported file format '${params.file.type}`)
     }