mirror of
https://invent.kde.org/system/dolphin
synced 2024-07-04 17:30:55 +00:00
Do not abort/exit when accessing the string out of bounds
svn path=/trunk/playground/utils/dolphin/; revision=612585
This commit is contained in:
parent
6cb02408e4
commit
cb2b58535b
|
@ -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('/');
|
||||
}
|
||||
|
|
Loading…
Reference in New Issue
Block a user