[escher] SelectableTableView: fix wrong assert

This commit is contained in:
Émilie Feral
2018-11-26 14:29:37 +01:00
committed by EmilieNumworks
parent ca2fdf8ffd
commit df45f800e1

View File

@@ -158,7 +158,15 @@ void SelectableTableView::unhighlightSelectedCell() {
if (selectedColumn() >= 0 && selectedColumn() < dataSource()->numberOfColumns() &&
selectedRow() >= 0 && selectedRow() < dataSource()->numberOfRows()) {
HighlightCell * previousCell = cellAtLocation(selectedColumn(), selectedRow());
assert(previousCell);
previousCell->setHighlighted(false);
/* Previous cell does not always exist.
* For example, unhighlightSelectedCell can be called twice:
* - from selectCellAtLocation
* - and then from m_delegate->tableViewDidChangeSelection inside unhighlightSelectedCell
* The first call selects an invisible cell. At the time of the second call,
* the selected cell might be still invisible because scrolling happens
* after. */
if (previousCell) {
previousCell->setHighlighted(false);
}
}
}