diff --git a/src/categorizedbookmarkmodel.cpp b/src/categorizedbookmarkmodel.cpp
index 75ddb605236605646cdeb220d2e0979541fe9c59..f86eadcd0a07886ef5f72ba25d0520ae46bf0cc7 100644
--- a/src/categorizedbookmarkmodel.cpp
+++ b/src/categorizedbookmarkmodel.cpp
@@ -336,7 +336,7 @@ QModelIndex CategorizedBookmarkModel::parent( const QModelIndex& idx) const
 ///Get the index
 QModelIndex CategorizedBookmarkModel::index(int row, int column, const QModelIndex& parent) const
 {
-   if (parent.isValid() && !column)
+   if (parent.isValid() && (!column) && d_ptr->m_lCategoryCounter.size() > parent.row() && d_ptr->m_lCategoryCounter[parent.row()]->m_lChildren.size() > row)
       return createIndex(row,column,(void*) static_cast<CategorizedCompositeNode*>(d_ptr->m_lCategoryCounter[parent.row()]->m_lChildren[row]));
    else if (row >= 0 && row < d_ptr->m_lCategoryCounter.size() && !column) {
       return createIndex(row,column,(void*) static_cast<CategorizedCompositeNode*>(d_ptr->m_lCategoryCounter[row]));