Skip to content

OpenToonz - An open-source full-featured 2D animation creation software

C

Fix failing assert in filebrowswermodel

Jeremy Bullock2d62e6ffd53b
diff --git a/toonz/sources/toonz/filebrowsermodel.cpp b/toonz/sources/toonz/filebrowsermodel.cpp
index 1021323c6..26f6ca14b 100644
--- a/toonz/sources/toonz/filebrowsermodel.cpp
+++ b/toonz/sources/toonz/filebrowsermodel.cpp
@@ -1289,9 +1289,9 @@ void DvDirModel::onFolderChanged(const TFilePath &path) { refreshFolder(path); }
void DvDirModel::refresh(const QModelIndex &index) {
if (!index.isValid()) return;
DvDirModelNode *node = getNode(index);
- if (!node) return;
+ if (!node || node->getChildCount() < 1) return;
emit layoutAboutToBeChanged();
- emit beginRemoveRows(index, 0, node->getChildCount());
+ emit beginRemoveRows(index, 0, node->getChildCount() - 1);
node->refreshChildren();
emit endRemoveRows();
emit layoutChanged();