From b322d37a92710f8846f7a518a86cc3976825508f Mon Sep 17 00:00:00 2001 From: Jose Antonio Ortega Ruiz Date: Sun, 8 Mar 2009 21:50:43 +0100 Subject: * emms-browser.el (emms-browser-make-hash-by): Check that field is present before attempting to add entries. Addresses an issue'm encountered when using lastfm integration and mpd as the player. After requesting streaming from last.fm, a new track gets added to EMMS' database, which is named after the streaming URL but has no other fields. Thus, when adding entries or making searches, checking the the field at hand is non-nil is needed. This patch checks that for emms-browser-make-hash-by. --- lisp/emms-browser.el | 9 +++++---- 1 file changed, 5 insertions(+), 4 deletions(-) (limited to 'lisp/emms-browser.el') diff --git a/lisp/emms-browser.el b/lisp/emms-browser.el index 1329a60..d1c85d7 100644 --- a/lisp/emms-browser.el +++ b/lisp/emms-browser.el @@ -656,10 +656,11 @@ compilations, etc." 'emms-browser-filter-tracks-hook track) (setq field (emms-browser-get-track-field track type)) - (setq existing-entry (gethash field hash)) - (if existing-entry - (puthash field (cons track existing-entry) hash) - (puthash field (list track) hash)))) + (when field + (setq existing-entry (gethash field hash)) + (if existing-entry + (puthash field (cons track existing-entry) hash) + (puthash field (list track) hash))))) emms-cache-db) hash)) -- cgit v1.2.3 From f201cdb3786319fbd2b2e4661327ab3e3e1cc677 Mon Sep 17 00:00:00 2001 From: Jose Antonio Ortega Ruiz Date: Sun, 8 Mar 2009 21:50:44 +0100 Subject: (emms-browser-mmatches-p): When performing searches, check whether This is the second patch addressing the null track fields issue. In this case, before trying to STRING-MATCH in a search, we check that the track's field is non-null. --- lisp/emms-browser.el | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) (limited to 'lisp/emms-browser.el') diff --git a/lisp/emms-browser.el b/lisp/emms-browser.el index d1c85d7..5286d75 100644 --- a/lisp/emms-browser.el +++ b/lisp/emms-browser.el @@ -1509,9 +1509,9 @@ included." (dolist (item search-list) (setq matched nil) (dolist (field (car item)) - (when (string-match (cadr item) - (emms-track-get track field "")) - (setq matched t))) + (let ((track-field (emms-track-get track field ""))) + (when (and track-field (string-match (cadr item) track-field)) + (setq matched t)))) (unless matched (setq no-match t))) (not no-match))) -- cgit v1.2.3