diff options
Diffstat (limited to 'sx-encoding.el')
-rw-r--r-- | sx-encoding.el | 6 |
1 files changed, 4 insertions, 2 deletions
diff --git a/sx-encoding.el b/sx-encoding.el index 3ce1d6b..63a3464 100644 --- a/sx-encoding.el +++ b/sx-encoding.el @@ -152,8 +152,10 @@ numbers identifying the gzip file format. See URL `http://www.gzip.org/zlib/rfc-gzip.html'." ;; Credit: http://emacs.stackexchange.com/a/2978 - (equal (substring (string-as-unibyte data) 0 2) - (unibyte-string 31 139))) + (let ((unidata (string-as-unibyte data))) + (when (<= 2 (length unidata)) + (equal (substring unidata 0 2) + (unibyte-string 31 139))))) (defun sx-encoding-gzipped-buffer-p (buffer) "Check if BUFFER is gzip-compressed. |