diff options
| author | Holger Freyther <[email protected]> | 2006-12-11 21:52:04 +0000 |
|---|---|---|
| committer | Holger Freyther <[email protected]> | 2006-12-11 21:52:04 +0000 |
| commit | cb2b58535bedacbec50b3dad9680b1fa4fe30a9e (patch) | |
| tree | 9f1ab2a696dbcdbd474ea06696ec105071a2ab72 | |
| parent | 6cb02408e418ca864c9e02d55f3358a1a7c64a15 (diff) | |
Do not abort/exit when accessing the string out of bounds
svn path=/trunk/playground/utils/dolphin/; revision=612585
| -rw-r--r-- | src/urlnavigator.cpp | 4 |
1 files changed, 2 insertions, 2 deletions
diff --git a/src/urlnavigator.cpp b/src/urlnavigator.cpp index 2e7a77fbf..1545a4907 100644 --- a/src/urlnavigator.cpp +++ b/src/urlnavigator.cpp @@ -136,7 +136,7 @@ void UrlNavigator::setUrl(const KUrl& url) { QString urlStr(url.pathOrUrl()); //kDebug() << "setUrl(" << url << ")" << endl; - if (urlStr.at(0) == '~') { + if ( urlStr.length() > 0 && urlStr.at(0) == '~') { // replace '~' by the home directory urlStr.remove(0, 1); urlStr.insert(0, QDir::home().path()); @@ -203,7 +203,7 @@ KUrl UrlNavigator::url(int index) const QString path(url().pathOrUrl()); path = path.section('/', 0, index); - if (path.at(path.length()-1) != '/') + if ( path.length() >= 1 && path.at(path.length()-1) != '/') { path.append('/'); } |
