From 5ef778fd8576e70b28ed26e7318ff30328547100 Mon Sep 17 00:00:00 2001 From: "Uwe L. Korn" Date: Mon, 8 Jul 2013 19:11:44 +0200 Subject: [PATCH] Fix crash on trying highlight a row if none has been hovered over yet --- src/libtomahawk/playlist/PlaylistItemDelegate.cpp | 10 +++++++--- 1 file changed, 7 insertions(+), 3 deletions(-) diff --git a/src/libtomahawk/playlist/PlaylistItemDelegate.cpp b/src/libtomahawk/playlist/PlaylistItemDelegate.cpp index 01f10ca6f..7d7bdc42f 100644 --- a/src/libtomahawk/playlist/PlaylistItemDelegate.cpp +++ b/src/libtomahawk/playlist/PlaylistItemDelegate.cpp @@ -467,9 +467,13 @@ PlaylistItemDelegate::resetHoverIndex() m_hoveringOver = QModelIndex(); m_infoButtonRects.clear(); - PlayableItem* item = m_model->sourceModel()->itemFromIndex( m_model->mapToSource( idx ) ); - if ( item ) - item->requestRepaint(); + QModelIndex itemIdx = m_model->mapToSource( idx ); + if ( itemIdx.isValid() ) + { + PlayableItem* item = m_model->sourceModel()->itemFromIndex( itemIdx ); + if ( item ) + item->requestRepaint(); + } emit updateIndex( idx ); m_view->repaint();