diff options
Diffstat (limited to 'lib/bookmarks')
-rw-r--r-- | lib/bookmarks/model/bookmarkitem.cpp | 5 |
1 files changed, 4 insertions, 1 deletions
diff --git a/lib/bookmarks/model/bookmarkitem.cpp b/lib/bookmarks/model/bookmarkitem.cpp index 4715b6f..21d034f 100644 --- a/lib/bookmarks/model/bookmarkitem.cpp +++ b/lib/bookmarks/model/bookmarkitem.cpp @@ -51,8 +51,11 @@ bool BookmarkItem::appendChild(BookmarkItem *childItem) bool BookmarkItem::insertChild(int position, BookmarkItem *childItem) { + // position is invalid (-1) when dropping an item onto the folder, which leads to crash + // make sure that position passed is >= 0 (insert item at first position) + if(m_type == Folder || m_type == Root) { - m_children.insert(position, childItem); + m_children.insert(qMax(position, 0), childItem); return true; } |