diff options
author | Yoann Laissus <yoann.laissus@gmail.com> | 2010-03-25 12:22:04 +0100 |
---|---|---|
committer | Yoann Laissus <yoann.laissus@gmail.com> | 2010-03-25 12:22:04 +0100 |
commit | 9ede70edadea14f3a1ee4d66ca03ec20a6133f72 (patch) | |
tree | 7afde06ad86d37f1c652901aaa3108dd93d7e31c /src/bookmarks/bookmarkspanel.cpp | |
parent | Add missing files (diff) | |
download | rekonq-9ede70edadea14f3a1ee4d66ca03ec20a6133f72.tar.xz |
Add tests for the bookmark before toGroup()
Diffstat (limited to 'src/bookmarks/bookmarkspanel.cpp')
-rw-r--r-- | src/bookmarks/bookmarkspanel.cpp | 13 |
1 files changed, 8 insertions, 5 deletions
diff --git a/src/bookmarks/bookmarkspanel.cpp b/src/bookmarks/bookmarkspanel.cpp index c50ebcdb..fdf1b3d8 100644 --- a/src/bookmarks/bookmarkspanel.cpp +++ b/src/bookmarks/bookmarkspanel.cpp @@ -157,13 +157,16 @@ void BookmarksPanel::autoExpand(const QModelIndex &root) { int count = m_treeView->model()->rowCount(root); - QModelIndex temp; + QModelIndex index; for(int i = 0; i < count; i++) { - temp = m_treeView->model()->index(i,0,root); - m_treeView->setExpanded(temp, bookmarkForIndex(temp).toGroup().isOpen()); - autoExpand(temp); + index = m_treeView->model()->index(i, 0, root); + if(index.isValid() && bookmarkForIndex(index).isGroup()) + { + m_treeView->setExpanded(index, bookmarkForIndex(index).toGroup().isOpen()); + autoExpand(index); + } } } @@ -369,7 +372,7 @@ void BookmarksPanel::editBookmark() void BookmarksPanel::openAll() { QModelIndex index = m_treeView->currentIndex(); - if(!index.isValid()) + if(!index.isValid() || !bookmarkForIndex(index).isGroup()) return; QList<KUrl> allChild = bookmarkForIndex(index).toGroup().groupUrlList(); |