From 67452baa4dcc9cab7574e173648caa0f1e72aff7 Mon Sep 17 00:00:00 2001 From: David Sansome Date: Sat, 11 Dec 2010 10:58:15 +0000 Subject: [PATCH] Fix a crash when requesting an invalid playlist index over MPRIS. Fixes issue #1041 --- src/core/mpris.cpp | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/src/core/mpris.cpp b/src/core/mpris.cpp index 66d00f021..eb4170119 100644 --- a/src/core/mpris.cpp +++ b/src/core/mpris.cpp @@ -273,7 +273,11 @@ int Mpris1TrackList::GetLength() const { } QVariantMap Mpris1TrackList::GetMetadata(int pos) const { - return Mpris1::GetMetadata(player_->GetItemAt(pos)->Metadata()); + PlaylistItemPtr item = player_->GetItemAt(pos); + if (!item) + return QVariantMap(); + + return Mpris1::GetMetadata(item->Metadata()); } void Mpris1TrackList::SetLoop(bool enable) {