1
0
mirror of https://github.com/tomahawk-player/tomahawk.git synced 2025-08-11 16:44:05 +02:00

handle errors gracefully

This commit is contained in:
Leo Franchi
2011-02-16 13:35:57 -05:00
parent 4153dc00ec
commit ba33bbc38c

View File

@@ -218,7 +218,15 @@ DynamicView::collapseEntries( int startRow, int num, int numToKeep )
if( !justFade ) {
/// sanity checks. make sure we have all the rows we need
int firstSlider = startRow + realNum;
Q_ASSERT( firstSlider + numToKeep - 1 <= proxyModel()->rowCount() );
qDebug() << "Sliding from" << firstSlider << "number:" << numToKeep - 1 << "rowcount is:" << proxyModel()->rowCount();
// we may have removed some rows since we first started counting, so adjust
//Q_ASSERT( firstSlider + numToKeep - 1 <= proxyModel()->rowCount() );
if( firstSlider + numToKeep - 1 >= proxyModel()->rowCount() ) {
if( numToKeep == 1 ) { // we just want the last row
firstSlider = proxyModel()->rowCount();
}
}
topLeft = proxyModel()->index( startRow + realNum, 0, QModelIndex() );
bottomRight = proxyModel()->index( startRow + realNum + numToKeep - 1, proxyModel()->columnCount( QModelIndex() ) - 1, QModelIndex() );