1
0
mirror of https://github.com/tomahawk-player/tomahawk.git synced 2025-08-13 17:43:59 +02:00

Fix null pointer crash in treeproxymodel

This commit is contained in:
Jeff Mitchell
2011-08-28 03:47:11 -04:00
parent 7166ba161f
commit d2af8a8a39

View File

@@ -230,7 +230,7 @@ Tomahawk::result_ptr
TreeProxyModel::currentItem() const TreeProxyModel::currentItem() const
{ {
TreeModelItem* item = itemFromIndex( mapToSource( currentIndex() ) ); TreeModelItem* item = itemFromIndex( mapToSource( currentIndex() ) );
if ( item && item->result()->isOnline() ) if ( item && !item->result().isNull() && item->result()->isOnline() )
return item->result(); return item->result();
return Tomahawk::result_ptr(); return Tomahawk::result_ptr();
} }
@@ -239,6 +239,9 @@ TreeProxyModel::currentItem() const
QString QString
TreeProxyModel::textForItem( TreeModelItem* item ) const TreeProxyModel::textForItem( TreeModelItem* item ) const
{ {
if ( !item )
return QString();
if ( !item->artist().isNull() ) if ( !item->artist().isNull() )
{ {
return item->artist()->name(); return item->artist()->name();