mirror of
https://github.com/tomahawk-player/tomahawk.git
synced 2025-08-06 14:16:32 +02:00
Guard against divide-by-0
This commit is contained in:
@@ -190,7 +190,7 @@ AlbumView::resizeEvent( QResizeEvent* event )
|
|||||||
int itemWidth = 160;
|
int itemWidth = 160;
|
||||||
QSize itemSize = m_proxyModel->data( QModelIndex(), Qt::SizeHintRole ).toSize();
|
QSize itemSize = m_proxyModel->data( QModelIndex(), Qt::SizeHintRole ).toSize();
|
||||||
|
|
||||||
int itemsPerRow = qFloor( rectWidth / itemWidth );
|
int itemsPerRow = qMax( 1, qFloor( rectWidth / itemWidth ) );
|
||||||
// int rightSpacing = rectWidth - ( itemsPerRow * ( itemSize.width() + 16 ) );
|
// int rightSpacing = rectWidth - ( itemsPerRow * ( itemSize.width() + 16 ) );
|
||||||
// int newSpacing = 16 + floor( rightSpacing / ( itemsPerRow + 1 ) );
|
// int newSpacing = 16 + floor( rightSpacing / ( itemsPerRow + 1 ) );
|
||||||
|
|
||||||
|
Reference in New Issue
Block a user