aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--lisp/emms-score.el17
1 files changed, 9 insertions, 8 deletions
diff --git a/lisp/emms-score.el b/lisp/emms-score.el
index 78e17db..f4cb5cc 100644
--- a/lisp/emms-score.el
+++ b/lisp/emms-score.el
@@ -246,14 +246,15 @@ See also `emms-next-noerror'."
"Load score hash from `emms-score-file'."
(interactive)
(if (file-exists-p emms-score-file)
- (mapc (lambda (elt)
- (puthash (car elt) (cdr elt) emms-score-hash))
- (read
- (with-temp-buffer
- (emms-insert-file-contents emms-score-file)
- (buffer-string))))
- ;; when file not exists, make empty but valid score file
- (emms-score-save-hash)))
+ (let ((score-string (with-temp-buffer
+ (emms-insert-file-contents emms-score-file)
+ (buffer-string))))
+ (if (> (length score-string) 0)
+ (mapc (lambda (elt)
+ (puthash (car elt) (cdr elt) emms-score-hash))
+ (read score-string)))
+ ;; when file not exists, make empty but valid score file
+ (emms-score-save-hash))))
(defun emms-score-get-plist (filename)
(gethash filename emms-score-hash))