Commit 4c76cb6a36795f78450d1ce7e34bad491889269e
1 parent
d2d43f11
Exists in
master
and in
5 other branches
It was not handling when user cancel an importation of other file formats
Showing
1 changed file
with
9 additions
and
8 deletions
Show diff stats
invesalius/control.py
| ... | ... | @@ -203,17 +203,18 @@ class Controller(): |
| 203 | 203 | # Import project treating compressed nifti exception |
| 204 | 204 | suptype = ('hdr', 'nii', 'nii.gz', 'par') |
| 205 | 205 | filepath = dialog.ShowImportOtherFilesDialog(id_type) |
| 206 | - name = filepath.rpartition('\\')[-1].split('.') | |
| 206 | + if filepath is not None: | |
| 207 | + name = filepath.rpartition('\\')[-1].split('.') | |
| 207 | 208 | |
| 208 | - if name[-1] == 'gz': | |
| 209 | - name[1] = 'nii.gz' | |
| 209 | + if name[-1] == 'gz': | |
| 210 | + name[1] = 'nii.gz' | |
| 210 | 211 | |
| 211 | - filetype = name[1].lower() | |
| 212 | + filetype = name[1].lower() | |
| 212 | 213 | |
| 213 | - if filetype in suptype: | |
| 214 | - Publisher.sendMessage("Open other files", filepath) | |
| 215 | - else: | |
| 216 | - dialog.ImportInvalidFiles() | |
| 214 | + if filetype in suptype: | |
| 215 | + Publisher.sendMessage("Open other files", filepath) | |
| 216 | + else: | |
| 217 | + dialog.ImportInvalidFiles() | |
| 217 | 218 | |
| 218 | 219 | def ShowDialogOpenProject(self): |
| 219 | 220 | # Offer to save current project if necessary | ... | ... |