branch: externals/ebdb
commit 429cdb0f281e4d52f3e854f216f54a6dd43e11f8
Author: Eric Abrahamsen <[email protected]>
Commit: Eric Abrahamsen <[email protected]>
Add safety check to ebdb-undisplay-records
* ebdb-com.el (ebdb-undisplay-records): It's possible we could be
passed a non-existent buffer.
---
ebdb-com.el | 15 ++++++++-------
1 file changed, 8 insertions(+), 7 deletions(-)
diff --git a/ebdb-com.el b/ebdb-com.el
index b215967..438cede 100644
--- a/ebdb-com.el
+++ b/ebdb-com.el
@@ -720,13 +720,14 @@ name based on the current major mode."
If BUFFER is nil, use the *EBDB* buffer associated with the
current buffer."
- (let ((buf (or buffer (ebdb-make-buffer-name))))
- (with-current-buffer (get-buffer buf)
- (when (eq major-mode 'ebdb-mode)
- (let (buffer-read-only)
- (erase-buffer))
- (setq ebdb-records nil)
- (set-buffer-modified-p nil)))))
+ (let ((buf (get-buffer (or buffer (ebdb-make-buffer-name)))))
+ (when buf
+ (with-current-buffer buf
+ (when (eq major-mode 'ebdb-mode)
+ (let (buffer-read-only)
+ (erase-buffer))
+ (setq ebdb-records nil)
+ (set-buffer-modified-p nil))))))
(defun ebdb-redisplay-all-records (_ignore-auto _noconfirm)
"Used as the value of `revert-buffer-function' in *EBDB* buffers."