From 577609b3e33680e1dd10b769c63e0298f7762cd4 Mon Sep 17 00:00:00 2001 From: Felix Geyer Date: Thu, 9 Jul 2015 23:17:04 +0200 Subject: [PATCH] Make calling QSaveFile::commit() non-fatal if it's not open. --- src/core/qsavefile.cpp | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/src/core/qsavefile.cpp b/src/core/qsavefile.cpp index 247535006..bddf18c97 100644 --- a/src/core/qsavefile.cpp +++ b/src/core/qsavefile.cpp @@ -279,7 +279,10 @@ bool QSaveFile::commit() Q_D(QSaveFile); if (!d->tempFile) return false; - Q_ASSERT(isOpen()); + if (!isOpen()) { + qWarning("QSaveFile::commit: File (%s) is not open", qPrintable(fileName())); + return false; + } QIODevice::close(); // flush and close if (d->error != QFile::NoError) { d->tempFile->remove();