diff widgets/ModelDataTableDialog.cpp @ 1271:d967e21fe995

Avoid crash when scrolling with an empty layer open
author Chris Cannam
date Mon, 23 Apr 2018 16:04:51 +0100
parents a7df0d728020
children 0ded54e94332
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;