Browse Source

fix file selection null error

Alexander Rose 5 years ago
parent
commit
ae407248af
1 changed files with 3 additions and 0 deletions
  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}`)
     }