Maybe fixed a potential segfault (0-1 as row index)

This commit is contained in:
Matthias Koefferlein 2020-06-15 01:26:49 +02:00
parent 61c9c12414
commit 84a9853435
1 changed files with 4 additions and 1 deletions

View File

@ -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 ()