summaryrefslogtreecommitdiffstats
path: root/src
diff options
context:
space:
mode:
authorVincas Dargis <vindrg@gmail.com>2019-03-22 10:40:12 +0200
committerVincas Dargis <vindrg@gmail.com>2019-03-26 06:12:10 +0000
commitb58c723404594d04f0b31b425da77b4fcbeec3b9 (patch)
tree4ecb6b73494254a075f13eb178e7f9404639235a /src
parenta57ac1b20e34decced0355935fe352eb55f51e5c (diff)
QSqlError: fix redundant space in text() output
QSqlError::text() returns single space if QSqlError is not valid. In addition, it adds space in case one of driverText or databaseText is empty. Change condition upon which space is added between databaseText and driverText, and update unit test to cover these cases. Fixes: QTBUG-74575 Change-Id: I52cce9b0287a523d7ff9059cff38bcd8b26eb303 Reviewed-by: Andy Shaw <andy.shaw@qt.io>
Diffstat (limited to 'src')
-rw-r--r--src/sql/kernel/qsqlerror.cpp2
1 files changed, 1 insertions, 1 deletions
diff --git a/src/sql/kernel/qsqlerror.cpp b/src/sql/kernel/qsqlerror.cpp
index 41ea497ad7..7a1a91948c 100644
--- a/src/sql/kernel/qsqlerror.cpp
+++ b/src/sql/kernel/qsqlerror.cpp
@@ -365,7 +365,7 @@ QString QSqlError::nativeErrorCode() const
QString QSqlError::text() const
{
QString result = d->databaseError;
- if (!d->databaseError.endsWith(QLatin1String("\n")))
+ if (!d->databaseError.isEmpty() && !d->driverError.isEmpty() && !d->databaseError.endsWith(QLatin1String("\n")))
result += QLatin1Char(' ');
result += d->driverError;
return result;