From 99906aa0d923b39dcc1f8978367c65146e47937d Mon Sep 17 00:00:00 2001 From: Leo Liu Date: Thu, 27 Jun 2013 12:27:53 +0800 Subject: [PATCH] * net/eww.el (eww-read-bookmarks): Check file size. --- lisp/ChangeLog | 4 ++++ lisp/net/eww.el | 10 ++++++---- 2 files changed, 10 insertions(+), 4 deletions(-) diff --git a/lisp/ChangeLog b/lisp/ChangeLog index badc5be27f9..379a1ec9f7d 100644 --- a/lisp/ChangeLog +++ b/lisp/ChangeLog @@ -1,3 +1,7 @@ +2013-06-27 Leo Liu + + * net/eww.el (eww-read-bookmarks): Check file size. + 2013-06-26 Stefan Monnier * emacs-lisp/nadvice.el (advice--defalias-fset): Move advice back to diff --git a/lisp/net/eww.el b/lisp/net/eww.el index 3579f656a1d..63fe930b4ae 100644 --- a/lisp/net/eww.el +++ b/lisp/net/eww.el @@ -965,10 +965,12 @@ The browser to used is specified by the `shr-external-browser' variable." (pp eww-bookmarks (current-buffer)))) (defun eww-read-bookmarks () - (with-temp-buffer - (insert-file-contents - (expand-file-name "eww-bookmarks" user-emacs-directory)) - (setq eww-bookmarks (read (current-buffer))))) + (let ((file (expand-file-name "eww-bookmarks" user-emacs-directory))) + (setq eww-bookmarks + (unless (zerop (or (nth 7 (file-attributes file)) 0)) + (with-temp-buffer + (insert-file-contents file) + (read (current-buffer))))))) (defun eww-list-bookmarks () "Display the bookmarks." -- 2.11.4.GIT