diff options
author | Kenji Sugita <sugita@sra.co.jp> | 2010-03-22 14:38:10 (GMT) |
---|---|---|
committer | Benjamin Poulain <benjamin.poulain@nokia.com> | 2010-03-22 14:51:37 (GMT) |
commit | 77b913e5f8fa93c62a245685d55d76eec2e9021a (patch) | |
tree | a7674c32ec5ee5ad9be545190acc193c37d1eaa0 /src | |
parent | 9da453e5579ebb6fb0361e4df4cfa7107e560b23 (diff) | |
download | Qt-77b913e5f8fa93c62a245685d55d76eec2e9021a.zip Qt-77b913e5f8fa93c62a245685d55d76eec2e9021a.tar.gz Qt-77b913e5f8fa93c62a245685d55d76eec2e9021a.tar.bz2 |
Fix behavior change QStringList::join() for null
Before 4.6.2 both str.isNull() and str.isEmpty() return true for the
following code.
QStringList list;
QString str = list.join(QString());
This commit revert the behavior change introduced by
7461ed5227e3002c4a6f74d458aa0255b7c1217d. Joining null
QString was giving a empty string instead of a null
string.
Reviewed-by: Benjamin Poulain <benjamin.poulain@nokia.com>
Diffstat (limited to 'src')
-rw-r--r-- | src/corelib/tools/qstringlist.cpp | 2 |
1 files changed, 2 insertions, 0 deletions
diff --git a/src/corelib/tools/qstringlist.cpp b/src/corelib/tools/qstringlist.cpp index e9bdf57..32a0b1e 100644 --- a/src/corelib/tools/qstringlist.cpp +++ b/src/corelib/tools/qstringlist.cpp @@ -414,6 +414,8 @@ QString QtPrivate::QStringList_join(const QStringList *that, const QString &sep) totalLength += sep.size() * (size - 1); QString res; + if (totalLength == 0) + return res; res.reserve(totalLength); for (int i = 0; i < that->size(); ++i) { if (i) |