From 0d368e59068a748e70f4eab51a4e6a07a038d0ad Mon Sep 17 00:00:00 2001 From: Daguerreo Date: Wed, 1 Dec 2021 22:59:57 +0100 Subject: [PATCH] Added null pointer check in item addition --- plugin/tree_model.cpp | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/plugin/tree_model.cpp b/plugin/tree_model.cpp index f3b6cd1..b26273d 100644 --- a/plugin/tree_model.cpp +++ b/plugin/tree_model.cpp @@ -96,12 +96,14 @@ QVariant TreeModel::data(const QModelIndex& index, const int role) const void TreeModel::addTopLevelItem(TreeItem* child) { - addItem(_rootItem, child); + if(child){ + addItem(_rootItem, child); + } } void TreeModel::addItem(TreeItem* parent, TreeItem* child) { - if(!child){ + if(!child || !parent){ return; }