From 751aed1813b49cfae6f0b744031f824147f34343 Mon Sep 17 00:00:00 2001 From: Kuzma30 Date: Mon, 27 May 2024 14:19:12 +0000 Subject: [PATCH] Fix potential problems. https://forum.freecad.org/viewtopic.php?t=70256#p762073 --- src/Gui/Document.cpp | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/src/Gui/Document.cpp b/src/Gui/Document.cpp index af50786ea4..410a193ff7 100644 --- a/src/Gui/Document.cpp +++ b/src/Gui/Document.cpp @@ -1209,8 +1209,12 @@ bool Document::saveAs() getMainWindow()->showMessage(QObject::tr("Save document under new filename...")); QString exe = qApp->applicationName(); + QString name = QString::fromUtf8(getDocument()->FileName.getValue()); + if(name.isEmpty()){ + name = QString::fromUtf8(getDocument()->Label.getValue()); + } QString fn = FileDialog::getSaveFileName(getMainWindow(), QObject::tr("Save %1 Document").arg(exe), - QString::fromUtf8(getDocument()->Label.getValue()), + name, QString::fromLatin1("%1 %2 (*.FCStd)").arg(exe, QObject::tr("Document"))); if (!fn.isEmpty()) {