summaryrefslogtreecommitdiffstats
path: root/src
diff options
context:
space:
mode:
authorDenis Shienkov <denis.shienkov@gmail.com>2015-04-18 18:06:14 +0300
committerDenis Shienkov <denis.shienkov@gmail.com>2015-04-20 12:54:11 +0000
commitac7abb59f6c8a673ccea5278c31934a7270055c6 (patch)
tree0b8fcbad1de53cad30ed8777325608101376a304 /src
parentf5572287da680b67712b5c3f3cd4a64bf97acd1b (diff)
Cleanup an error string when QSP::clearError() is called
QSP::clearError() calls setError() with an empty error string. But setError() anyway calls the qt_error_string() that sets an error string from an system error which occurred before, that is garbage in this case. Thus, we need to call qt_error_string() only if the input QSP::SerialPortError is not NoError. (cherry-picked from 6ae78369d1156e653df6a2e539230a89cf963b00) Change-Id: I949f30ca8bf260c8884e819524909fd6cd32ad5e Reviewed-by: Denis Shienkov <denis.shienkov@gmail.com>
Diffstat (limited to 'src')
-rw-r--r--src/serialport/qserialport.cpp2
1 files changed, 1 insertions, 1 deletions
diff --git a/src/serialport/qserialport.cpp b/src/serialport/qserialport.cpp
index 8731d247..ee60119f 100644
--- a/src/serialport/qserialport.cpp
+++ b/src/serialport/qserialport.cpp
@@ -1371,7 +1371,7 @@ void QSerialPort::setError(QSerialPort::SerialPortError serialPortError, const Q
d->error = serialPortError;
- if (errorString.isNull())
+ if (errorString.isNull() && (serialPortError != QSerialPort::NoError))
setErrorString(qt_error_string(-1));
else
setErrorString(errorString);