Skip to content

Commit

Permalink
fix: crash on character export
Browse files Browse the repository at this point in the history
  • Loading branch information
sithlord48 committed May 28, 2024
1 parent 5e2164a commit 0738790
Showing 1 changed file with 6 additions and 1 deletion.
7 changes: 6 additions & 1 deletion src/dialogs/bcdialog.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -90,6 +90,11 @@ QString BCDialog::getExistingDirectory(QWidget *parent, const QString &title, co

QString BCDialog::getSaveFileName(QWidget *parent, const QString &region, const QString &title, const QString &path , const QString &nameFilters, QString* chosenType, const QString &initSelection)
{
if(chosenType == nullptr) {
QString filter = nameFilters.mid(0, (nameFilters.indexOf(";;") - 2));
chosenType = &filter;
}

auto dialog = getFileDialog(parent, title, path, nameFilters, initSelection);
dialog->setFileMode(QFileDialog::AnyFile);
dialog->setAcceptMode(QFileDialog::AcceptSave);
Expand Down Expand Up @@ -136,7 +141,7 @@ QString BCDialog::getSaveFileName(QWidget *parent, const QString &region, const
});
}

if(!chosenType->isEmpty())
if(!chosenType->isEmpty() && chosenType != nullptr)
dialog->selectNameFilter(chosenType->mid(0));

if(dialog->exec() == QFileDialog::Accepted) {
Expand Down

0 comments on commit 0738790

Please sign in to comment.