Merge "Minor robustness improvement of text code"

This commit is contained in:
Eirik Aavitsland 2021-03-11 16:04:50 +01:00 committed by Qt CI Bot
commit 57dd386d42

View File

@ -240,9 +240,11 @@ QString QTextDocumentWriter::fileName () const
*/
bool QTextDocumentWriter::write(const QTextDocument *document)
{
QByteArray suffix;
if (!d->device)
return false;
if (d->device && d->format.isEmpty()) {
QByteArray suffix;
if (d->format.isEmpty()) {
// if there's no format, see if device is a file, and if so, find
// the file suffix
if (QFile *file = qobject_cast<QFile *>(d->device))