From 84a9853435424f2aac46014a395ce8c50208d5c1 Mon Sep 17 00:00:00 2001 From: Matthias Koefferlein Date: Mon, 15 Jun 2020 01:26:49 +0200 Subject: [PATCH] Maybe fixed a potential segfault (0-1 as row index) --- src/lay/lay/layMacroEditorTree.cc | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/src/lay/lay/layMacroEditorTree.cc b/src/lay/lay/layMacroEditorTree.cc index 703cf7aaa..da5b3bcea 100644 --- a/src/lay/lay/layMacroEditorTree.cc +++ b/src/lay/lay/layMacroEditorTree.cc @@ -161,7 +161,10 @@ void MacroTreeModel::macro_changed () void MacroTreeModel::update_data () { - emit dataChanged (index (0, 0, QModelIndex ()), index (rowCount (QModelIndex()) - 1, 0, QModelIndex ())); + int rc = rowCount (QModelIndex()); + if (rc > 0) { + emit dataChanged (index (0, 0, QModelIndex ()), index (rc - 1, 0, QModelIndex ())); + } } void MacroTreeModel::about_to_change ()