summaryrefslogtreecommitdiffstats
path: root/src/corelib/io/qurl.cpp
diff options
context:
space:
mode:
Diffstat (limited to 'src/corelib/io/qurl.cpp')
-rw-r--r--src/corelib/io/qurl.cpp4
1 files changed, 2 insertions, 2 deletions
diff --git a/src/corelib/io/qurl.cpp b/src/corelib/io/qurl.cpp
index 649b3a009c..3e711b12ec 100644
--- a/src/corelib/io/qurl.cpp
+++ b/src/corelib/io/qurl.cpp
@@ -777,7 +777,7 @@ void QUrlPrivate::setUserInfo(const QString &userInfo, int from, int end)
int delimIndex = userInfo.indexOf(QLatin1Char(':'), from);
setUserName(userInfo, from, qMin<uint>(delimIndex, end));
- if (delimIndex == -1) {
+ if (uint(delimIndex) >= uint(end)) {
password.clear();
sectionIsPresent &= ~Password;
sectionHasError &= ~Password;
@@ -2159,7 +2159,7 @@ QString QUrl::toString(FormattingOptions options) const
d->appendPath(url, options, QUrlPrivate::FullUrl);
// check if we need to remove trailing slashes
- if ((options & StripTrailingSlash) && d->path != QLatin1String("/") && url.endsWith(QLatin1Char('/')))
+ if ((options & StripTrailingSlash) && !d->path.isEmpty() && d->path != QLatin1String("/") && url.endsWith(QLatin1Char('/')))
url.chop(1);
}