summaryrefslogtreecommitdiffstats
path: root/smtreemodel.cpp
diff options
context:
space:
mode:
Diffstat (limited to 'smtreemodel.cpp')
-rw-r--r--smtreemodel.cpp2
1 files changed, 1 insertions, 1 deletions
diff --git a/smtreemodel.cpp b/smtreemodel.cpp
index 292ed20..227c1cb 100644
--- a/smtreemodel.cpp
+++ b/smtreemodel.cpp
@@ -168,7 +168,7 @@ bool SmTreeModel::addRow(const QList<QVariant> &data, const QModelIndex &parent)
SmTreeItem *parentItem = itemAt(parent);
if(insertRows(parentItem->childCount(), 1, parent)){
- SmTreeItem *child = parentItem->child(parentItem->childCount());
+ SmTreeItem *child = parentItem->child(parentItem->childCount() - 1);
delete child;
SmTreeItem *newChild = new SmTreeItem(data, parentItem);
child = newChild;