diff options
author | Michael Olson <mwolson@gnu.org> | 2007-04-09 05:54:00 +0000 |
---|---|---|
committer | Michael Olson <mwolson@gnu.org> | 2007-04-09 05:54:00 +0000 |
commit | de2edaf1dce1e13b0212845b290178d97997067c (patch) | |
tree | e7c562f87c70c0241acf40daaae3423fd49de2d9 | |
parent | 5495e8c0655a1e5137ceaf0cc8331433cdae54bf (diff) |
emms-url: Avoid stringp errors when fetch of page failed
darcs-hash:20070409055428-1bfb2-caef9a48dbe90295d8dc374de00143e77cf19803.gz
-rw-r--r-- | emms-url.el | 21 |
1 files changed, 12 insertions, 9 deletions
diff --git a/emms-url.el b/emms-url.el index b3841c2..d77a382 100644 --- a/emms-url.el +++ b/emms-url.el @@ -50,10 +50,12 @@ variable." (append url nil)))) (defun emms-http-content-coding () - (and (boundp 'url-http-content-type) - (string-match ";\\s-*charset=\\([^;[:space:]]+\\)" - url-http-content-type) - (intern-soft (downcase (match-string 1 url-http-content-type))))) + (save-match-data + (and (boundp 'url-http-content-type) + (stringp url-http-content-type) + (string-match ";\\s-*charset=\\([^;[:space:]]+\\)" + url-http-content-type) + (intern-soft (downcase (match-string 1 url-http-content-type)))))) (defun emms-http-decode-buffer (&optional buffer) "Recode the buffer with `url-retrieve's contents. Else the @@ -61,11 +63,12 @@ buffer would contain multibyte chars like \\123\\456." (with-current-buffer (or buffer (current-buffer)) (let* ((default (or (car default-process-coding-system) 'utf-8)) (coding (or (emms-http-content-coding) default))) - ;; (pop-to-buffer (current-buffer)) - ;; (message "content-type: %s" url-http-content-type) - ;; (message "coding: %S [default: %S]" coding default) - (set-buffer-multibyte t) - (decode-coding-region (point-min) (point-max) coding)))) + (when coding + ;; (pop-to-buffer (current-buffer)) + ;; (message "content-type: %s" url-http-content-type) + ;; (message "coding: %S [default: %S]" coding default) + (set-buffer-multibyte t) + (decode-coding-region (point-min) (point-max) coding))))) (provide 'emms-url) ;;; emms-url.el ends here |