Mercurial > hg > svgui
comparison 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 |
comparison
equal
deleted
inserted
replaced
1270:7527701c8076 | 1271:d967e21fe995 |
---|---|
206 } | 206 } |
207 | 207 |
208 void | 208 void |
209 ModelDataTableDialog::makeCurrent(int row) | 209 ModelDataTableDialog::makeCurrent(int row) |
210 { | 210 { |
211 if (m_table->rowCount() == 0 || | |
212 row >= m_table->rowCount() || | |
213 row < 0) { | |
214 return; | |
215 } | |
216 | |
211 int rh = m_tableView->height() / m_tableView->rowHeight(0); | 217 int rh = m_tableView->height() / m_tableView->rowHeight(0); |
212 int topRow = row - rh/4; | 218 int topRow = row - rh/4; |
213 if (topRow < 0) topRow = 0; | 219 if (topRow < 0) topRow = 0; |
214 | 220 |
215 // should only scroll if the desired row is not currently visible | 221 // should only scroll if the desired row is not currently visible |