diff options
-rw-r--r-- | src/corelib/io/qiodevice.cpp | 6 |
1 files changed, 6 insertions, 0 deletions
diff --git a/src/corelib/io/qiodevice.cpp b/src/corelib/io/qiodevice.cpp index dae4e82..56fff90 100644 --- a/src/corelib/io/qiodevice.cpp +++ b/src/corelib/io/qiodevice.cpp @@ -468,11 +468,17 @@ void QIODevice::setOpenMode(OpenMode openMode) otherwise the \l Text flag is removed. This feature is useful for classes that provide custom end-of-line handling on a QIODevice. + The IO device should be opened before calling this function. + \sa open(), setOpenMode() */ void QIODevice::setTextModeEnabled(bool enabled) { Q_D(QIODevice); + if (!isOpen()) { + qWarning("QIODevice::setTextModeEnabled: The device is not open"); + return; + } if (enabled) d->openMode |= Text; else |