mirror of
https://github.com/tomahawk-player/tomahawk.git
synced 2025-08-05 13:47:26 +02:00
Fix crash on misbehaving VA albums
This commit is contained in:
@@ -510,7 +510,12 @@ ColumnView::onUpdatePreviewWidget( const QModelIndex& index )
|
|||||||
m_previewWidget->setQuery( item->result()->toQuery() );
|
m_previewWidget->setQuery( item->result()->toQuery() );
|
||||||
|
|
||||||
QList< int > widths = columnWidths();
|
QList< int > widths = columnWidths();
|
||||||
const int previewWidth = viewport()->width() - widths.at( 0 ) - widths.at( 1 ) - widths.at( 2 );
|
int previewWidth = viewport()->width() - widths.at( 0 ) - widths.at( 1 ) - widths.at( 2 );
|
||||||
|
// Sometimes we do not have 3 columns because of wrong usage of the ColumnView.
|
||||||
|
// At least do not crash.
|
||||||
|
for (int i = 0; i < 3 && i < widths.length(); i++ ) {
|
||||||
|
previewWidth -= widths.at( i );
|
||||||
|
}
|
||||||
widths.removeLast();
|
widths.removeLast();
|
||||||
widths << qMax( previewWidth, m_previewWidget->minimumSize().width() + 32 );
|
widths << qMax( previewWidth, m_previewWidget->minimumSize().width() + 32 );
|
||||||
setColumnWidths( widths );
|
setColumnWidths( widths );
|
||||||
|
Reference in New Issue
Block a user