From d2af8a8a393c86492d32530c8b336fcf94f212c2 Mon Sep 17 00:00:00 2001 From: Jeff Mitchell Date: Sun, 28 Aug 2011 03:47:11 -0400 Subject: [PATCH] Fix null pointer crash in treeproxymodel --- src/libtomahawk/playlist/treeproxymodel.cpp | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/src/libtomahawk/playlist/treeproxymodel.cpp b/src/libtomahawk/playlist/treeproxymodel.cpp index 4dbd8e0c3..a8ffe3e7f 100644 --- a/src/libtomahawk/playlist/treeproxymodel.cpp +++ b/src/libtomahawk/playlist/treeproxymodel.cpp @@ -230,7 +230,7 @@ Tomahawk::result_ptr TreeProxyModel::currentItem() const { TreeModelItem* item = itemFromIndex( mapToSource( currentIndex() ) ); - if ( item && item->result()->isOnline() ) + if ( item && !item->result().isNull() && item->result()->isOnline() ) return item->result(); return Tomahawk::result_ptr(); } @@ -239,6 +239,9 @@ TreeProxyModel::currentItem() const QString TreeProxyModel::textForItem( TreeModelItem* item ) const { + if ( !item ) + return QString(); + if ( !item->artist().isNull() ) { return item->artist()->name();