Skip to content

Commit

Permalink
Add validation to the file format dialog
Browse files Browse the repository at this point in the history
Signed-off-by: Geoff Hutchison <[email protected]>
  • Loading branch information
ghutchis committed Oct 11, 2023
1 parent 8554c95 commit 6c3a966
Showing 1 changed file with 8 additions and 0 deletions.
8 changes: 8 additions & 0 deletions avogadro/qtgui/fileformatdialog.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -42,6 +42,14 @@ FileFormatDialog::FormatFilePair FileFormatDialog::fileToRead(
if (fileName.isEmpty()) // user cancel
return result;

if (FileFormat::validateFileName(fileName.toStdString()) == false) {
QMessageBox::warning(
parent, caption,
tr("The file name contains invalid characters. Please choose another "
"file name."));
continue;
}

const Io::FileFormat* format = findFileFormat(
parent, caption, fileName, FileFormat::File | FileFormat::Read);

Expand Down

0 comments on commit 6c3a966

Please sign in to comment.