changeset 1271:d967e21fe995

Avoid crash when scrolling with an empty layer open
author Chris Cannam
date Mon, 23 Apr 2018 16:04:51 +0100
parents 7527701c8076
children 0ded54e94332
files widgets/ModelDataTableDialog.cpp
diffstat 1 files changed, 6 insertions(+), 0 deletions(-) [+]
line wrap: on
line diff
--- a/widgets/ModelDataTableDialog.cpp	Thu Apr 19 14:36:16 2018 +0100
+++ b/widgets/ModelDataTableDialog.cpp	Mon Apr 23 16:04:51 2018 +0100
@@ -208,6 +208,12 @@
 void
 ModelDataTableDialog::makeCurrent(int row)
 {
+    if (m_table->rowCount() == 0 ||
+        row >= m_table->rowCount() ||
+        row < 0) {
+        return;
+    }
+    
     int rh = m_tableView->height() / m_tableView->rowHeight(0);
     int topRow = row - rh/4;
     if (topRow < 0) topRow = 0;