Skip to content

Commit

Permalink
fix: fix warning (file doesn't exist) when we cancel QFileDialog
Browse files Browse the repository at this point in the history
  • Loading branch information
Montel committed Oct 9, 2024
1 parent 36541c8 commit b738f33
Showing 1 changed file with 4 additions and 1 deletion.
5 changes: 4 additions & 1 deletion src/gui/treesitterinspector.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -142,7 +142,10 @@ TreeSitterInspector::~TreeSitterInspector()

void TreeSitterInspector::saveToFile()
{
QString fileName = QFileDialog::getSaveFileName(this, tr("Save Query"), "", tr("Query Files (*.scm)"));
const QString fileName = QFileDialog::getSaveFileName(this, tr("Save Query"), "", tr("Query Files (*.scm)"));
if (fileName.isEmpty()) {
return;
}

QFile file(fileName);
// Note: at least on Linux, the file dialog will already warn if the file exists, so no need
Expand Down

0 comments on commit b738f33

Please sign in to comment.