Skip to content

Commit

Permalink
#5721: Some rudimentary path validation
Browse files Browse the repository at this point in the history
  • Loading branch information
codereader committed Aug 22, 2021
1 parent e922249 commit be38aeb
Showing 1 changed file with 8 additions and 2 deletions.
10 changes: 8 additions & 2 deletions radiant/ui/modelexport/ConvertModelDialog.cpp
Expand Up @@ -156,12 +156,18 @@ void ConvertModelDialog::onConvert(wxCommandEvent& ev)
std::string outputFilename = findNamedObject<wxutil::PathEntry>(this, "OutputPathFilePicker")->getValue();
std::string outputFormat = wxutil::ChoiceHelper::GetSelectedStoredString(findNamedObject<wxChoice>(this, "OutputFormatChoice"));

if (outputFilename.empty())
if (inputFilename.empty())
{
wxutil::Messagebox::Show(_("Empty Filename"), _("No filename specified, cannot run exporter"), IDialog::MessageType::MESSAGE_ERROR);
wxutil::Messagebox::Show(_("Empty Input Filename"), _("No input filename specified, cannot run converter"), IDialog::MessageType::MESSAGE_ERROR);
return;
}

if (outputFilename.empty() || os::getExtension(outputFilename).empty())
{
wxutil::Messagebox::Show(_("Empty Filename"), _("No valid output filename specified, cannot run converter"), IDialog::MessageType::MESSAGE_ERROR);
return;
}

// Check if the target file already exists
if (os::fileOrDirExists(outputFilename) &&
wxutil::Messagebox::Show(_("Confirm Replacement"),
Expand Down

0 comments on commit be38aeb

Please sign in to comment.