diff --git a/src/musikbox/app/window/TrackListView.cpp b/src/musikbox/app/window/TrackListView.cpp index 9216494e6..afef9eafa 100755 --- a/src/musikbox/app/window/TrackListView.cpp +++ b/src/musikbox/app/window/TrackListView.cpp @@ -54,6 +54,9 @@ using namespace musik::core::audio; using namespace musik::core::library; using namespace musik::box; using namespace cursespp; + +static IScrollAdapter::EntryPtr MISSING_ENTRY = IScrollAdapter::EntryPtr(); + TrackListView::TrackListView( PlaybackService& playback, LibraryPtr library, @@ -66,6 +69,12 @@ TrackListView::TrackListView( this->adapter = new Adapter(*this); this->lastQueryHash = 0; this->formatter = formatter; + + if (!MISSING_ENTRY) { + auto e = std::shared_ptr(new SingleLineEntry("track missing")); + e->SetAttrs(COLOR_PAIR(CURSESPP_TEXT_ERROR)); + MISSING_ENTRY = e; + } } TrackListView::~TrackListView() { @@ -200,6 +209,10 @@ IScrollAdapter::EntryPtr TrackListView::Adapter::GetEntry(size_t index) { TrackPtr track = parent.metadata->Get(index); + if (!track) { + return MISSING_ENTRY; + } + TrackPtr playing = parent.playing; if (playing && playing->Id() == track->Id() &&