diff --git a/escher/src/selectable_table_view.cpp b/escher/src/selectable_table_view.cpp index 634ea08d5..05c003d3b 100644 --- a/escher/src/selectable_table_view.cpp +++ b/escher/src/selectable_table_view.cpp @@ -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); + } } }