summaryrefslogtreecommitdiffstats
path: root/src/network/ssl/qsslcertificate.cpp
diff options
context:
space:
mode:
Diffstat (limited to 'src/network/ssl/qsslcertificate.cpp')
-rw-r--r--src/network/ssl/qsslcertificate.cpp5
1 files changed, 3 insertions, 2 deletions
diff --git a/src/network/ssl/qsslcertificate.cpp b/src/network/ssl/qsslcertificate.cpp
index b1ec1d06e2..96ba68089d 100644
--- a/src/network/ssl/qsslcertificate.cpp
+++ b/src/network/ssl/qsslcertificate.cpp
@@ -482,8 +482,9 @@ QList<QSslCertificate> QSslCertificate::fromPath(const QString &path,
if (pos != -1) {
// there was a special char in the path so cut of the part containing that char.
pathPrefix = pathPrefix.left(pos);
- if (pathPrefix.contains(QLatin1Char('/')))
- pathPrefix = pathPrefix.left(pathPrefix.lastIndexOf(QLatin1Char('/')));
+ const int lastIndexOfSlash = pathPrefix.lastIndexOf(QLatin1Char('/'));
+ if (lastIndexOfSlash != -1)
+ pathPrefix = pathPrefix.left(lastIndexOfSlash);
else
pathPrefix.clear();
} else {