summaryrefslogtreecommitdiff
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-19 10:52:17 +0000
commit6ae78369d1156e653df6a2e539230a89cf963b00 (patch)
treed01079cff70b731ba69517ae79d0d22de7eaf567
parent9a9aed53e1e23200d471ced91a83fbca9976f231 (diff)
downloadqtserialport-6ae78369d1156e653df6a2e539230a89cf963b00.tar.gz
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. Change-Id: I0260159d74579de47bcf1c7b2f4e747be6817269 Reviewed-by: Sergey Belyashov <Sergey.Belyashov@gmail.com> Reviewed-by: Denis Shienkov <denis.shienkov@gmail.com>
-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 2dfdd0b..e9c6922 100644
--- a/src/serialport/qserialport.cpp
+++ b/src/serialport/qserialport.cpp
@@ -1370,7 +1370,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);