Procházet zdrojové kódy

fix file selection null error

Alexander Rose před 5 roky
rodič
revize
ae407248af
1 změnil soubory, kde provedl 3 přidání a 0 odebrání
  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}`)
     }